javascript do while loop
Post on 14-Apr-2016
215 Views
Preview:
DESCRIPTION
Javascript do while loop
TRANSCRIPT
I think the idea there is not to repeat yourself. You're calling prompt twice. You can overcome this by declaring the variable that will be defined in the loop later.
Also, make sure you terminate your statements in JS with semicolons.
var secret;
do { secret = prompt("What is the secret password?");
} while ( secret !== "sesame" );
document.write("You know the secret password. Welcome.");
top related