Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Duncan Murtagh
Duncan Murtagh
1,557 Points

"Create a do...while loop" Challenge getting: "Bummer: There was an error with your code: SyntaxError: Parse error"

Hi, I am getting a "Bummer: There was an error with your code: SyntaxError: Parse error" message with the code below. I have tried it in a Workspace and it works fine, but the Challenge is not accepting it. Please help.

let secret = "sesame"; do { secret = prompt("What is the secret password?"); } while ( secret !== "sesame" ) document.write("You know the secret password. Welcome."); console.log("You know the secret password. Welcome.");

2 Answers

Steven Parker
Steven Parker
231,153 Points

This course may have been developed before ES2015 syntax was in common use. Try using "var" instead of "let".

And the challenge doesn't ask for anything to be logged to the console. That shouldn't hurt, but for best results with challenges, do only what the instructions ask for.

Duncan Murtagh
Duncan Murtagh
1,557 Points

Thanks Steven. That worked.

It's quite annoying that this is a problem "This course may have been developed before ES2015 syntax was in common use. Try using "var" instead of "let"."