Last active
May 28, 2021 18:41
-
-
Save jamiejohnsonkc/30e3cf8c274a6c9f34b4da088193c25e to your computer and use it in GitHub Desktop.
guest list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: ' | |
for (let i = 0; i < people.length; i++) { | |
if (people[i] === 'Phil' || people[i] === 'Lola') { | |
refused.textContent += `${people[i]}, `; | |
} | |
else { | |
admitted.textContent += `${people[i]}, `; | |
} | |
} | |
refused.textContent = refused.textContent.slice(0,refused.textContent.length-2) + '.' | |
admitted.textContent = admitted.textContent.slice(0,admitted.textContent.length-2) + '.' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment