filter() ve map() yerine reduce() kullanmak

Prototürk'e geri dön
const numbers = [-5, 6, 2, 0,]

console.log(
    numbers
    .filter(number => number > 0)
    .map(number => number * 2)
)

console.log(
    numbers.reduce((acc, number) => {
        if (number > 0){
            acc.push(number * 2)
        }
        return acc
    }, [])
)