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.