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

Loek Weijts
6,159 PointsWhat i my mistake, the code isn't accepted. Bummer! You should declare the `secret` variable before the loop.
do {
var secret = prompt("What is the secret password?");
}
while ( secret !== "sesame" );
document.write("You know the secret password. Welcome.");
1 Answer

Cole Wilson
7,413 PointsYou can declare the variable outside of the loop so you don't have to keep creating a new variable everytime within the loop. Your code is very close.
This is what I did.
var secret;
do {
secret = prompt("What is the secret password?");
}
while ( secret !== "sesame" );
document.write("You know the secret password. Welcome.");

Loek Weijts
6,159 PointsThx! Glad i wasn't too far of
brock lynch
6,956 Pointsbrock lynch
6,956 PointsI haven't done this challenge yet, but I did run it in jsfiddle and it works. Maybe try declaring the variable secret outside of the loop.