Link Search Menu Expand Document

Iterate with JavaScript Do…While Loops

Summary

  • The do...while checks the conditions after the loop is ran (during an iteration).

Final Code

// Setup
var myArray = [];
var i = 10;

// Only change code below this line
do {
  myArray.push(i);
  i++;
} while (i < 5);