I'm trying to get into a bootcamp and this is a problem I'm clearly missing something on. I know I'm missing something obvious but I'm having trouble spotting it. Here's what I have so far:
function oddsUpTo(num) {
let arr = [];
for (let i = 1; i <= num; i += 2) {
if (num[i] % 2 === 1) {
arr.push(num[i]);
}
}
return arr;
}
console.log(oddsUpTo(20)) // should equal[1,3,5,7,9,11,13,15,17,19]