I'm trying to get the odd numbers in the following array and then multiply by 2 using reduce method but it's giving me undefined error. Any help please.
const multiplyOddByTwo = (arr) => {
return arr.reduce((acc, curr) => {
if (curr % 2 === 0) {
arr.push(curr);
} else {
arr.push(curr * 2)
}
}, [])
}
console.log(multiplyOddByTwo([1, 2, 3]));