Hey guys,
I’ve had a problem with one of the lessons in Js. The challenge in this case is:
Use a for
loop to work to push the values 1 through 5 onto myArray
.
Even though I used basically the same example they gave, as it is a fairly easy one, it keeps saying ’ You should be using a for
loop for this.’ as an error. Has this happened to anyone before?
Your code so far
var myArray = [];
for (var i = 1; i <= 5; i++) {
myArray.push(i);
}
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36
.
Challenge: Iterate with JavaScript For Loops
Link to the challenge: