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

I am getting a parse error when running below: where is my syntax off?

I've ran this in treehouse work space and it works fine. It doesn't seem to work under this challenge. Please help!

let secret;
let password = "sesame";
do {  
  secret = prompt("What is the secret password?");    
} while (secret!= password);
document.write("You know the secret password. Welcome.");
<!DOCTYPE html>
  <meta charset="utf-8">
  <title>JavaScript Loops</title>
<script src="script.js"></script>
Michael Cook
Michael Cook
Full Stack JavaScript Techdegree Student 26,185 Points

I ran your code in my Chrome console and it works fine. Some times the challenges are buggy. I suggest just refreshing the page and trying again.

2 Answers

Steven Parker
Steven Parker
202,109 Points

This is an older course and the parser apparently doesn't understand "let". Use "var" as was originally provided in the code instead.

Thanks everyone. I switched the variable to bar and it worked.

Steven Parker
Steven Parker
202,109 Points

Dhruvan Sampath — Glad to help. You can mark a question solved by choosing a "best answer".
And happy coding!