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 trialomar othman
7,441 Pointswhy does the challenge keeps posting this error when I finish it "Bummer! Your code took too long to run."?
is there something wrong with the code?
var count = 0;
while(count<26){
document.write();
}
4 Answers
elk6
22,916 PointsHi Omar,
Your code is stuck in a never ending loop. You are telling it to do something while count is less than 26, but count is always 0 since nothing gets added to it. So it will always be 0 and the code will run and run since it never hits 26. Try to increment count somewhere in your while-loop.
count++
jason chan
31,009 Pointscount++;
you need to increment your while loop each loop.
Jonathan Grieve
Treehouse Moderator 91,253 PointsThis typically happens when you're running an infinite loop through the challenge. What you need to do is give the code a way to break out from the loop.
var count = 0;
while(count<26){
document.write();
count++;
}
You can do this with the increment operator. Now the while loop will count the variable 25 times and stop when the value of count
is not longer less than 26.
Good luck. :-)
omar othman
7,441 Pointsthanks everyone!
omar othman
7,441 Pointsomar othman
7,441 Pointsoh, right, forgot that, thank you!
elk6
22,916 Pointselk6
22,916 PointsNo problem. :)