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 trialCesare Parmiggiani
8,017 PointsDon't understand
I don't understand the question...
I put a counter in the while but is wrong...
var counter = 1;
while ( counter === 11 ) {
document.write("<p>Now in loop #" + counter + "</p>");
counter += 1;
}
2 Answers
rydavim
18,814 PointsYou've got the right idea, but in your code, your while loop will only run if counter is strictly equal to 11. You want your loop to run any time counter is less than 11, so that it will run repeatedly.
var counter = 1;
while ( counter < 11 ) { // You'll need to change strictly equals to less than.
document.write("<p>Now in loop #" + counter + "</p>");
counter += 1;
}
Jeff Lemay
14,268 PointsYour condition in the while loop should be (counter < 11)
Cesare Parmiggiani
8,017 PointsCesare Parmiggiani
8,017 PointsJeff Lemay - rydavim
Thank you both!
I'm tired and I've been lost in an easy question...
..I'm also a beginner....
THANK you for helping me.
Cesare