Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //funkcja pozwalająca na wpisanie listy gości i sprawdzenie czy dany gość jest na liście.
- var guestList = [];
- function enterTheGuestList() {
- var numberOfGuests = prompt("Podaj liczbę swoich gości: ");
- for (var index = 0; index < numberOfGuests; index++) {
- guestList.push(prompt("Podaj imię gościa"));
- }
- return guestList;
- }
- function showGuestList() {
- alert(guestList);
- };
- function checkIfItsOnTheList() {
- var answer = "brak";
- while (answer) {
- answer = prompt("Podaj imię gościa");
- if (guestList.includes(answer)){
- alert("Hello there")
- }
- else{
- alert("Go away!")
- }
- }
- };
- enterTheGuestList();
- showGuestList();
- checkIfItsOnTheList();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement