I am currently working on developing a function called onlyOddNumbers that takes an array of numbers as input and outputs a new array with only the odd numbers. The function is operational, but I have encountered an issue where strings are being included in the new array instead of just numbers. Can someone explain why this is happening?
https://i.sstatic.net/UOyR3.png
let oddNumbersOnly=[]
const filter = function (numbers) {
for (number in numbers){
if(number %2 !==0){
oddNumbersOnly.push(number)
}
} return oddNumbersOnly;
};