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

JavaScript JavaScript Loops, Arrays and Objects Simplify Repetitive Tasks with Loops A Closer Look At Loop Conditions

i do not understand how to code this problem.

i've tried multiple time this code and it does not work

var pass= "sesame";
var secret=prompt("What is the secret password?");;
while(secret != pass.toUpperCase()){

  secret = prompt("What is the secret password?");
 document.write("You  do not know the secret password. Try again."); 

}

document.write("You know the secret password. Welcome.");

2 Answers

Tim Larson
seal-mask
.a{fill-rule:evenodd;}techdegree
Tim Larson
Full Stack JavaScript Techdegree Student 13,696 Points

Hello!

var secret = prompt("What is the secret password?");
while ( secret !== "sesame" ) {
  secret = prompt("What is the secret password?");    
}
document.write("You know the secret password. Welcome.");

Hopefully this works for you!

Maciej Sitko
Maciej Sitko
16,164 Points

It works completely fine.

I am guessing you are missing the point that secret needs to equal your pass in UPPERCASE (as you have set it in this case);