JS Fundamentals 03. House Party
Здравейте,
Гърмят ми първият и четвърти тест. Благодаря предварително!
https://pastebin.com/JGPd1mVj
1. House Party
Write a function that keeps track of guests that are going to a house party.
You will be given an array of strings. Each string will be one of the following:
- "{name} is going!"
- "{name} is not going!"
If you receive the first type of input, you have to add the person if he/she is not in the list (If he/she is in the list print: "{name} is already in the list!").
If you receive the second type of input, you have to remove the person if he/she is in the list (if not print: "{name} is not in the list!").
At the end print all the guests each on a separate line.
Examples
Input |
Output |
['Allie is going!', 'George is going!', 'John is not going!', 'George is not going!'] |
John is not in the list! Allie |
['Tom is going!', 'Annie is going!', 'Tom is going!', 'Garry is going!', 'Jerry is going!'] |
Tom is already in the list! Tom Annie Garry Jerry |
Еее благодаря колега, мислех, че ако има два стринга не е много редно да се вкарват по обратен ред, но и не бях много сигурен. Мислех да сложа каунтър който да брои стринговете и да сплайсва масива, но не стигнах до там.