JavaScript JavaScript Loops, Arrays and Objects Simplify Repetitive Tasks with Loops Create a `do...while` loop

Brittani Schuhmacher
Brittani Schuhmacher
2,087 Points

I came up with a solution, but it isn't accepted. I've tested it in the console and it works. What did I do incorrectly?

I'm sure it isn't pretty, but the solution is viable in my console. Please help!

script.js
var secret;
var guess = false;
var correctGuess = "Sesame";
do {
  secret = prompt("What is the secret password?"); 
  if (secret === correctGuess) {
    guess = true;
  }
} while (! guess)
document.write("You know the secret password. Welcome.");
index.html
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JavaScript Loops</title>
</head>
<body>
<script src="script.js"></script>
</body>
</html>

1 Answer

"Sesame" should be all lowercase

Brittani Schuhmacher
Brittani Schuhmacher
2,087 Points

Thank you! That was exactly correct!