DEV Community

loading...

Discussion on: Daily Challenge #172 - Find All in an Array

Collapse
ntvinhit profile image
Nguyễn Trọng Vĩnh
const findAll = (array, n) => array.reduce((prev, next, index) => next === n ? [...prev, index] : prev, []);