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 trialSeth Johnson
2,676 PointsIsn't this just missing the condition "counter > 11" ? I can't figure out what else would be missing.
If the counter starts at 1, then to run it 10 times you would just need the condition "counter > 11" in the parentheses. When I add this condition, I get an error message saying that document.write() is run undefined times.
var counter = 1;
while ( ) {
document.write("<p>Now in loop #" + counter + "</p>");
counter += 1;
}
1 Answer
Jason Anders
Treehouse Moderator 145,860 PointsHey Seth,
You're on the right track, you're just using the 'greater than' comparison instead of less than. Fix that and you are good to go
while ( counter < 11 )
Keep Coding! :)
Seth Johnson
2,676 PointsSeth Johnson
2,676 PointsAh! But of course...silly mistake. Thanks for your help!
Jason Anders
Treehouse Moderator 145,860 PointsJason Anders
Treehouse Moderator 145,860 PointsYou're welcome! :)