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 Create a `do...while` loop

John Frauenhoffer
John Frauenhoffer
2,008 Points

Javascript Do Quiz question

Hello all,

I am having trouble getting my code to do what the quiz wants. I've watched the video multiple times, and am trying to build my code based of the example in the last video. Can anyone look at this and tell me whats wrong. Thanks

script.js
var password = 'Sesame';
var correctGuess = false
var guess; 

do {
  guess = prompt("What is the secret password?");
  if (guess === password) {
    correctGuess = true;
  }
} while ( ! correctGuess ) 
  document.write("You know the secret password. Welcome.");
index.html
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JavaScript Loops</title>
</head>
<body>
<script src="script.js"></script>
</body>
</html>

2 Answers

Kevin Kenger
Kevin Kenger
32,834 Points

Hey John,

Good job with this! Unfortunately, the challenges can be really specific, and it's looking for "sesame" not "Sesame." Try changing your password variable to "sesame" with a lowercase S, and the challenge should accept your code.