DEV Community

Discussion on: Daily Challenge #208 - Delete Occurrences of an Element

Collapse
 
sabbin profile image
Sabin Pandelovitch

JS solution

const deleteNth = (arr, c) => arr.reduce((a, v) => a.filter(e => e === v).length < c ? [...a, v] : a, []);