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

Brenna Leker
Brenna Leker
7,596 Points

I keep getting "Bummer! Your code took to long to run." Am i doing something wrong or is it Treehouse?

I am in the new course Javascript Loops, Arrays and Objects in "Simplify repetitive tasks with loops" on the second challenge. The first challenge went through with not issues but I keep getting this error on the second one. I've been using Treehouse for several months now and have never encountered this error before.

Any help would be greatly appreciated.

Thank you, Brenna

script.js
var count = 0;

while(count<26){
  document.write (count);
  count=+1;
}

1 Answer

Yeah, your syntax is infinite loop.

var count = 0;

while(count < 26){
  document.write (count);
  // should be
  count += 1;
}
Brenna Leker
Brenna Leker
7,596 Points

Thank you so much for the speedy reply, that solved my issue!

No problem, Brenda. You could also type it this way too.

var count = 0;

while(count < 26){
  document.write (count);
  // should be
  count = count + 1;
}