DEV Community

Discussion on: Daily Coding Problem #2

Collapse
 
pavi2410 profile image
Pavitra Golchha
const pro = a => a.map(i => a.reduce((x, y) => x * y) / i)

pro([1, 2, 3, 4, 5]) // == [120, 60, 40, 30, 24]
pro([3, 2, 1]) // == [2, 3, 6]