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

General Discussion

Fang-Wen Shen
Fang-Wen Shen
6,779 Points

Remove

Remove

Abraham Juliot
Abraham Juliot
47,353 Points

LOL "my correct code wont work"

Well, you wrote a program to fail correctly

3 Answers

Shawn Flanigan
PLUS
Shawn Flanigan
Courses Plus Student 15,815 Points

Hi Fang-Wen,

Remember you'll need to increase your count variable every time you run the loop...otherwise your condition (count < 26) will always be true and the loop will run infinitely.

Shawn Flanigan
Shawn Flanigan
Courses Plus Student 15,815 Points

So...simply add count++; after document.write("poo"); and you should be golden.

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! While your code doesn't generate any errors, it does result in an infinite loop. You never alter the value of count so it will always be less than 26.

If I add an increment to count below your document.write, the challenge passes:

count++;

Hope this helps! :sparkles:

Steven Parker
Steven Parker
229,744 Points

If it was "correct code" then it would work. :smirk:

The problem in this case is that you don't change the count value inside the loop. So the condition being tested by the while is always true and the loop never stops.

The easiest fix would be to increment or add one to the count in the body of the loop.

And remember that what makes code "correct" is more than just having no errors. It must also do the right thing.