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 trialclifford dsouza
Full Stack JavaScript Techdegree Student 1,755 PointsYou don't always need to use a counter or specify an exact number of times that a loop must run. All you need is a condi
You don't always need to use a counter or specify an exact number of times that a loop must run. All you need is a condi
let secret;
do {
// Display the prompt dialogue while the value assigned to `secret` is not equal to "sesame"
let secret = prompt("What is the secret password?");
alert("Currently, no code checks the password.");
}
while (secret !== 'sesame')
// This should run after the loop is done executing
alert("You know the secret password. Welcome!");
2 Answers
Rabin Gharti Magar
Front End Web Development Techdegree Graduate 20,928 PointsHey clifford,
Remove let keyword and alert from your first code block and it should work fine!
After removing these, your code should look like this:
let secret;
do {
// Display the prompt dialogue while the value assigned to `secret` is not equal to "sesame"
secret = prompt("What is the secret password?");
}
while (secret !== 'sesame')
// This should run after the loop is done executing
alert("You know the secret password. Welcome!");
Hope this helps!
Adam N
70,280 PointsWhen you declare a variable with the let keyword, you're not allowed to redeclare it. For example, the following code produces an error:
let bob;
let bob = 5;
Fix this error in your program and you will be closer to passing this challenge.
Let me know if this helps!