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 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,526 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.