11 lines
298 B
Markdown
11 lines
298 B
Markdown
|
---
|
||
|
title: 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++;
|
||
|
}
|