Tell us what’s happening:
So, I was completely stumped by this question and decided to break my rules and go ahead and look for a hint, afterwards I got the right answer, but I still don’t understand why the hints worked, of course since this is a passing solution, I wrapped it in a Spoiler tag.
So, my main question is why does this code work? Can anyone give me a full explanation? Thanks
Note:
If you fear spoilers for the rest, feel free to DM me.
var ourArray = [];
for (var i = 0; i < 10; i += 2) {
ourArray.push(i);
}
// Setup
var myArray = [];
// Only change code below this line.
for (var i = 1; i < 10; i += 2) {
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/88.0.4324.96 Safari/537.36 Edg/88.0.705.56
.
Challenge: Iterate Odd Numbers With a For Loop
Link to the challenge: