Skip to content

Challenge Iterate with JavaScript While Loops

SaintPeter edited this page · 1 revision
Clone this wiki locally

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++;
}
Something went wrong with that request. Please try again.