+ 2
Use a looping... let valid=false; do{ let confirm = prompt("Enter passcode to view site"); switch (confirm) { case "123": alert("Welcome to website"); valid=true; break; default: alert("Try again"); valid=false; break; } }while(!valid);
24th Jan 2022, 3:13 PM
Jayakrishna 🇼🇳
0
I don't think. Alert makes background program to stop until you press ok. So time setting won't run on alert. But you can alternatives, of making custum alert through a function or div element and set timeout.. https://stackoverflow.com/questions/15466802/how-can-i-auto-hide-alert-box-after-it-showing-it https://stackoverflow.com/questions/1962861/javascript-alert-box-with-timer
25th Jan 2022, 10:31 AM
Jayakrishna 🇼🇳