0

Password validation mistake

Hi, guys! Can you help me with this code? let count = 4; let ask = +prompt("Введіть пароль"); do { if (ask === 'LOGOS') { alert("Запрошуємо на сайт!"); } else if (ask != 'LOGOS') { ask = +prompt("Введіть пароль"); alert(`Залишилось ${count} спроби`); } count--; } while (count > 0); if (count <= 0) alert("Будь ласка, спробуйте пізніше");

3rd May 2023, 3:32 PM
Nadia Den
Nadia Den - avatar
1 Antwort
+ 1
Putting + before promt, tries to convert input into number type. So for string input, don't put + before prompt. Remove it..
3rd May 2023, 3:56 PM
Jayakrishna 🇮🇳