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 trialDarion Suggs
Full Stack JavaScript Techdegree Student 3,064 PointsTook to long to run
why does it keep saying took to long to run?
var count = 0;
while(count < 26 ){
document.write("count");
}
1 Answer
Jonathan Grieve
Treehouse Moderator 91,253 PointsThis is what's known as an infinite loop. The loop has been given no instructions to cause the loop to end, so it'll just keep on running and running and eventually cause the browser, or whatever environment it's running on to run out of memory.
You might want to replace the string your passing to document.write
in with the variable reference as well. and increment the value of that variable for the loop to work.
count++;