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

it took too long to run?

I don't understand

script.js
var count = 0; 
while (count < 26) {
    document.write;

}

2 Answers

Kim Dallas, That's okay :) JavaScript as a whole language is a tough language to go through in one go. I still am learning about it myself in small chunks at a time!

Essentially this is an infinite loop, count is initialized to which means its always true, and since your printing basically space with the document.write function that why nothing prints because its always being evaluated to be zero . What are you trying to print out?

maybe use a for loop like this

var count; 
for(count = 0; count < 26; count++){
  document.write(/** put whatever output you want*/);
}

Thank you Bartholomew. I'm completely stuck with javascript. I'm getting better with html and css but javascript is baffling me. I'm trying to figure it out.