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 trialKaleb Ross
4,868 PointsI am even having trouble following some of the help I am getting but am still getting errors. More help?
I am not understanding some of the symbols used and why ie://?...I am going over the lesson again.
var secret = prompt("What is the secret password?");
do { var secret=prompt("what is the secret password");
}
while ( secret !== "sesame" ) {
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="script.js"></script>
</body>
</html>
Kaleb Ross
4,868 PointsI realized the forward slashes were only for the comments when I had help from someone...only my code still does not work
Kaleb Ross
4,868 PointsThank you, it has helped a lot...I was wanting to put to much code.
2 Answers
Henrik Christensen
Python Web Development Techdegree Student 38,322 PointsYou are close:
var secret; // remove prompt here because you will call it in the loop
do {
// when saying "var secret" here you are creating a NEW variable with the name "secret"
secret = prompt("what is the secret password?");
} while ( secret !== "sesame" ); // a do-while loop ends here - no more code needed
document.write("You know the secret password. Welcome.");
Kaleb Ross
4,868 PointsThank you, I was adding so much stuff and to boot it was in the wrong place...thanks again for the time
Aryaman Dhingra
3,536 PointsAryaman Dhingra
3,536 PointsWhich symbols are you talking about?