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 trialKit Howlett
6,774 PointsDon't understand why document.write() is not being called...
Hi,
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");
}
2 Answers
anthony amaro
8,686 Pointshello 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;
document.write(count);
}
hope this helps
Kit Howlett
6,774 PointsHi Anthony,
Oh now I understand! Thank you so much!
Kit Howlett
6,774 PointsKit Howlett
6,774 PointsI realised I needed to add:
but it is still not working