I'm trying to learn different ways of approaching a solution but when I find something that works I tend to blank on other ways to approach the solution. Can you please take the following and provide a different solution that has the same end result?
function reallyOdd(arr) {
const result = arr.filter((value, index) => {
if (index % 2 != 0) {
if (value % 2 != 0) {
return value;
}
}
});
return result;
}
console.log(reallyOdd([6, 12, 49777, 3512, 4, 3, 1, 54]));
The objective here is to find the odd numbers from a passed in array of numbers at the odd index.