DEV Community

loading...

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

Collapse
savagepixie profile image
SavagePixie

JavaScript

const findAll = (arr, n) => arr
   .reduce((a, b, i) => b === n
      ? a.concat(i)
      : a
   , [])