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

Mandy Rintala
Mandy Rintala
9,046 Points

Need Help with Coding Challenge for this Video

I feel like I need to add more code than what it's asking but I'm not sure what to add and how much. I keep wanting to add multiple variables to fill out the code but not sure how far to take it and where to stop. Any advice helps! Thank you.

1 Answer

Daniel Gauthier
Daniel Gauthier
15,000 Points

Hey Mandy,

I'm assuming you're looking for help with the challenge that follows the video you linked, which asks:

If so, the code it's looking for is below:

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.");

It's a little convoluted, but Dave has structured it this way to make a point in a later video that should become apparent once you get to that point.

If it was actually the challenge before the linked video, then the code it's looking for is:

var count = 0;

while (count < 26) {

  document.write(count);
  count++;

}

Good luck with the course!