Hi all
I don’t understand why i+2 would create an infinite loop while i+=2 would not. I was under the impression they both did the same thing. When doing basic maths they seem to do the same thing. It is important that I understand why things happen and not just that they do as it’s easier to remember stuff when it makes sense.
// 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 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36
Challenge: Iterate Odd Numbers With a For Loop
Link to the challenge: