JavaScript JavaScript Loops, Arrays and Objects Simplify Repetitive Tasks with Loops Create a while Loop

How do use document.write inside while loop

I set everything but still not understanding this quiz

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

}

1 Answer

Tobias Trinkler
Tobias Trinkler
Full Stack JavaScript Techdegree Student 16,534 Points

Hi Abdullahi,

try this one

var count = 0;

while(count < 26){
document.write(count)
count++;
}

You pass the counter variable into the document.write method. Every time the loops runs the count variable increases by 1.