Unable to Pass Iterate Odd Numbers With a For Loop

The code I did so far seems to match the solution but I am still unable to get pass this stage? Am I missing something here that I am not seeing?
I keep getting the message that myArray needs to be [1, 3, 5, 7, 9]…
Your code so far

// Setup
var myArray = [];

// Only change code below this line
for (var i = 1; i < 10; i += 2); {

  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36.

Challenge: Iterate Odd Numbers With a For Loop

Link to the challenge:

This semicolon is actually making your code into

for (var i = 1; i < 10; i += 2) {};
1 Like

Ahhhh! I found my error! Thank you so much. =)

Tipp: add a console.log( myArray) at the end.
This will put out the value in the preview-window and allow you to look for issues instead of just waiting for the tests to fail.
It’s a vital tool for debugging whenever programming, though ofcourse each program has different commands for that.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.