freeCodeCamp: Error in 'Waypoint: Iterate Odd Numbers With a For Loop'

The code that appears when this waypoint loads is the answer to the challenge.

Let’s change our initialization and final-expression so we can count by odd numbers. Push the odd numbers from 1 through 9 to myArray using a for loop.

var ourArray = [];
for(var i = 1; i < 10; i += 2){
  ourArray.push(i);
}
var myArray = [];
// Only change code below this line.

// Only change code above this line.
if(typeof(myArray) !== "undefined"){(function(){return myArray;})();}

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 15 (8 by maintainers)

Most upvoted comments

I think the point of this bug is that the rest of the waypoints don’t generally have the example code using ourArray be the exact same code you need to do with myArray. There’s usually some subtle difference between the two. In the one you could just copy and paste it and change our to my.