Iterate with JavaScript For Loops
Summary
- The
forloop runs a section of code for a certain number of times. for (a; b; c), whereais the intialization statement,bis the condition statement, andcis the final expression.
Final Code
// Setup
var myArray = [];
// Only change code below this line
for (var i = 1; i <= 5; i++) {
myArray.push(i);
}