Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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

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.");
<!DOCTYPE html>
  <meta charset="utf-8">
  <title>JavaScript Loops</title>
<script src="script.js"></script>

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.