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

Don't understand why document.write() is not being called...


I'm really not sure what I am getting wrong here. I get the following message: Bummer: The document.write() method wasn't called.

Can anyone solve this please and explain why?

Thank you!

var count = 0;
while (count > 26) {
 document.write("Testing Loops");

I realised I needed to add:

var count = 0;
while (count > 26) {
 count += 1;

but it is still not working

2 Answers

hello kit the loop doesn't run because you are saying that count is greater than 26 which is false because count = 0

and then you have to increase count before you print it to the page. if you print it to the page and then increase it. then the first time the loop runs count is going to be 0 and when the loop ends count is going to be 25 not 26;

var count = 0;

while(count < 26) {
  count += 1;

hope this helps

Hi Anthony,

Oh now I understand! Thank you so much!