So the thing is fairly simple to do and my code does what is supposed to but I’m getting the massage that I should be using For Loop for this. But I am. I am blind to see what’s wrong with my code.
EDIT: I am also getting the same message in the next lesson which is pretty similar.
Your code so far
// Setup
var myArray = [];
// Only change code below this line
for (var a =1; a < 6; a++) {
myArray.push(a);
}
console.log(myArray);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0.
Thank you for helping make FCC better. Bugs can be reported as GitHub Issues. Whenever reporting a bug, please check first that there isn’t already an issue for it and provide as much detail as possible.
So when I copy this and modify it to fit the lesson it works with every one. If I copy only bottom part it still doesn’t work. If I write exactly what you wrote it doesn’t work either.
@adamszczechura It turns out a bug was introduced for a few challenges when a pull request was merged yesterday. I am working on fixing the bug right now and hope to have the issue fixed as soon as possible.
We moved the example code out of the editor. The challenge test is looking to see two for loops, but because the example code for loop was removed, the tests fails since the solution would only have a single for loop in it. I am rewriting the tests to not look at the number of for loops, because that was a very brittle test to begin with.
var myArray = [];
// I closed the space between for () to for()
for(var i=1; i < 6; i++){
// using "i" is just a convention
// not technically right or wrong
myArray.push(i);
}