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

do know what I'm doing worng

I'm to make a while code that counts to 26

var count = 0;
while ( counter < 26 ) {  
  var count
   document.write( 'count ');
  count += 1:

1 Answer

Mckenzie Hessel
Mckenzie Hessel
Full Stack JavaScript Techdegree Graduate 20,437 Points
  1. Your variable is named "count" but you wrote "counter" in the while loop.
  2. You don't need to repeat "var count" inside the loop.
  3. You didn't put the closing brace ( } ) on the end
  4. Inside document.write(), count should not be in quotation marks (if it is the computer will think you want to print the string "count")
  5. You have a colon after your last line of code

It should look like this:

var count = 0; while ( count < 26 ) { document.write(count) count += 1 }