JavaScript JavaScript Loops, Arrays and Objects Simplify Repetitive Tasks with Loops Create a while Loop

Took to long to run

why does it keep saying took to long to run?

var count = 0;
while(count < 26 ){

1 Answer

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 87,183 Points

This 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.