while
" loop because it runs "while" a specified condition is true and stops once that condition is no longer true.
var ourArray = [];Let's try getting a while loop to work by pushing values to an array.
var i = 0;
while(i < 5) {
ourArray.push(i);
i++;
}
myArray
using a while
loop.
while
loop for this.
testString: 'assert(code.match(/while/g), ''You should be using a while
loop for this.'');'
- text: 'myArray
should equal [0,1,2,3,4]
.'
testString: 'assert.deepEqual(myArray, [0,1,2,3,4], ''myArray
should equal [0,1,2,3,4]
.'');'
```