After string // Only change code below this line. we add for loop. You need to copy loop from the top:
for (var i = 0; i < 10; i += 2) {
ourArray.push(i);
}
Hint 2
And change initializationvar i = 0 to var i = 1, also you need change name of the array ourArray to myArray:
for (var i = 1; i < 10; i += 2) {
myArray.push(i);
}
Solutions
Solution 1 (Click to Show/Hide)
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);
}
Solution
to go from counting even number to odd numbers change the count variable initialization from 0 to 1 and the < to <= to include 9 in the array.