Skip to content

Challenge Iterate With JavaScript While Loops

Quincy Larson edited this page Aug 20, 2016 · 1 revision

Challenge Iterate with JavaScript While Loops

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

var ourArray = [];
var i = 0;
while(i < 5) {
  ourArray.push(i);
  i++;
}
Clone this wiki locally