Oletem
9/28/2017 - 9:42 PM

Iterate with JavaScript While Loops

Another type of JavaScript loop is called a "while loop", because it runs "while" a specified condition is true and stops once that condition is no longer true.


// Setup
var myArray = [];

var i= 0;

while(i<5){
  
  myArray.push(i);
  
  i++;
  
}

// Only change code below this line.