var passwordSession = sessionStorage.getItem("password");
if(passwordSession != true) {
var password = prompt("Please enter your password");
do {
password = prompt("Please enter your password");
} while (password == "123456");
sessionStorage.setItem("password", true);
}
"true"
и true
.