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 trialKong Yang
1,370 PointsI don't understand what the challenge is asking me to do.
Just need some help with interpreting the challenge I suppose.
var secret = prompt("What is the secret password?");
document.write("You know the secret password. Welcome.");
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JavaScript Loops</title>
</head>
<body>
<script src="app.js"></script>
</body>
</html>
1 Answer
Jennifer Nordell
Treehouse TeacherThe beginning of the challenge sets up a prompt to ask for the secret password. It simply wants you to keep asking the user for a password until they enter the correct one. Take a look at my solution:
var secret = prompt("What is the secret password?");
while (secret !== "sesame") {
secret = prompt("That's not the password! Try again: ");
}
document.write("You know the secret password. Welcome.");
Tushar Singh
Courses Plus Student 8,692 PointsTushar Singh
Courses Plus Student 8,692 PointsChallenge is just to keep on bugging a user unless he enters "sesame", for that you need a while loop. So unless the user types "sesame", it will keep on showing the prompt.