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 trialGlenn Robinson
4,581 Pointsthe only error msg I get is "try again." this is my 4th day on this problem and my 4th time giving it to the community.
let secret;
let password = "sesame";
do{
secret = prompt("What is the secret password?");
}
while ("secret" !== "password");
alert("You know the secret password. Welcome!");
1 Answer
Jennifer Nordell
Treehouse TeacherHi there, Glenn Robinson! I see you've tried and done a lot of good work. The reason it keeps telling you to try again and can't tell you much else is because you've inadvertently created an infinite loop. You are saying to keep doing it while the string "secret" is not equal to the string "password". But they will always not be equal.
What you mean to say is while the value stored in the variable secret
is not equal to the value stored in the variable password
, keep asking.
The problem is this line:
while ("secret" !== "password");
But you meant:
while (secret !== password);
Hope this helps!
Glenn Robinson
4,581 PointsGlenn Robinson
4,581 Pointsthat doesnt work for me either but i will try again thanks
Jennifer Nordell
Treehouse TeacherJennifer Nordell
Treehouse TeacherGlenn Robinson then the implication there is probably that something is cached. Copy the code you have above. Press the "Restart" button on the challenge. Then remove the quotations around secret and password. Because your code minus those quotation marks passes the challenge for me. You might even try in another browser if it persists.