This is the code I came up with for the Active learning: filling in a guest list. The live output was not working properly and I saw that my code was different from the solution. I wanted to know if my code accomplishes the same as the solution given. Please give me feedback on what I could do differently. Here is the link to the active learning: https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Building_blocks/Looping_code
const people = [‘Chris’, ‘Anne’, ‘Colin’, ‘Terri’, ‘Phil’, ‘Lola’, ‘Sam’, ‘Kay’, ‘Bruce’];
const admitted = document.querySelector(’.admitted’);
const refused = document.querySelector(’.refused’);
admitted.textContent = 'Admit: ';
refused.textContent = 'Refuse: ’
let i = 0;
while (i < people.length) {
if(people[i] === ‘Phil’ || people[i] === ‘Lola’) {
refused.textContent += people[i] + ', ';
} else {
admitted.textContent += people[i] + ', ';
}
i++;
}
refused.textContent = refused.textContent.replace(’, ‘, ‘.’);
admitted.textContent = admitted.textContent.replace(’, ', ‘.’);