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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![lassek](https://secure.gravatar.com/avatar/bfd327edafd74f2fb70238d9889fc71f?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
lassek
8,209 PointsTask 1 not accepting a solution
Seems to be a flaw in this exercise: the following solution isn't accepted:
var secret ;
while (secret=prompt("What is the secret password?") !== "sesame") {}
document.write("You know the secret password. Welcome.");
I get this message:
Bummer: Use the strict not equals operator -- !== -- to compare the variable secret
and the string 'sesame'.
var secret ;
while (secret=prompt("What is the secret password?")!=="sesame") {}
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>
3 Answers
![<noob />](https://uploads.teamtreehouse.com/production/profile-photos/10467642/micro_205-2059901_patrick-star-majin-buu.jpg)
<noob />
17,062 PointsYou are close. you are being ask to use the while loop and handle what happens if the pass is not “sesame”. for that you just need to use the while loop and check it secret is not password, if it’s not the password u keep prompting.
var secret = prompt("What is the secret password?");
while(secret !== "sesame") { secret = prompt("That's not it! Try again"); }
document.write("You know the secret password. Welcome.");
![lassek](https://secure.gravatar.com/avatar/bfd327edafd74f2fb70238d9889fc71f?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
lassek
8,209 PointsThank's for the reply. When re-reading the task, it states what I should change - and changing the var statement which is necessary with my solution isn't mentioned so strictly I'm not doing what I'm asked to do, and I guess therefore it's not accepting it (however giving a confusing error message)
Imo the "correct" solution looks like bad coding practice that shouldn't be taught since it unnecessarily repeats code, and there is a simpler solution.
![Steven Parker](https://uploads.teamtreehouse.com/production/profile-photos/969492/micro_tool_chess_set_2.jpg)
Steven Parker
230,688 PointsAs you continue, you'll get to another task which will have you simplify the solution by using a different strategy.
![lassek](https://secure.gravatar.com/avatar/bfd327edafd74f2fb70238d9889fc71f?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
lassek
8,209 Points@Steven, ok I can see that as a good approach to teach refining actually.
![<noob />](https://uploads.teamtreehouse.com/production/profile-photos/10467642/micro_205-2059901_patrick-star-majin-buu.jpg)
<noob />
17,062 PointsI think the solution is cleaner and more readable. you declare the variable at the top of the script in order not to create a new variable every check in the while loop in