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

it didn't work

what am I doing wrong?

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

1 Answer

You have closed the prompt function bracket INSIDE the string, so the function is not actually closed and does not work. This is why the close bracket is a different colour to the open bracket. The colours are there to help you.

thank you