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

Code Challenge JavaScript Loops

In this challenge, you will create a while loop that prints to the document 26 times. We've added a variable named count , use it to track the number of times the loop runs. Don't forget to use the document.write() method inside the loop. (JavaScript Loops)

when I enter my answer for the challenge, the system says that " Your code took too long to run. " over and over again until it tells me to seek help from the teamtreehouse.

Please post your code, so we can see what the issue is. thanks.

3 Answers

I just tried it again and it worked this time. Thanks Jacob! var count = 0; while ( count < 26 ) { document.write(count + ' '); count += 1; }

Hey, you did It, I just asked for your code, congrats! By the way the I gave you the best answer for this because you answered it yourself. In my book that will always be the best answer! Happy coding!

Kendall Chung
Kendall Chung
9,511 Points

hey i have tried using the code it says syntax error. this is what i have got so far, can someone please help me?

var count = 0; while (count < 26 ); { document.write(count + ' '); count += 1; }

Its because he did not write the entire code to pass the challenge. What part of the challenge are you having problems with?