When I try to submit my answer, I get the response ‘you should be using a for loop for this’. I’ve copied my code below for reference, but I’ve already looked at the solution so I know this should be correct! Can anyone help?
var myArray = ;
for (var i = 1; i < 6; i++) {
myArray.push(i);
}
var myArray = [];
for (var i = 1; i < 6; i++) {
myArray.push(i);
}
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36
.
Challenge: Iterate with JavaScript For Loops
Link to the challenge: