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

Tevi Lawson
Tevi Lawson
5,645 Points

It keeps saying my took too long to run

is this a system error or did I miss something?

script.js
var count =0;
while (count < 25){
document.write("count")
}

1 Answer

Kyle Knapp
Kyle Knapp
21,521 Points

You aren't incrementing count, so count will remain at 0, and since 0 is always less than 25, your program becomes stuck in an infinite while loop, which is why it keeps saying your program took too long to run.