Merge pull request #701 from Chalarangelo/fix-indexOfAll

indexOfAll.md returns a functions with shadow vars
This commit is contained in:
Angelos Chalaris
2018-08-02 23:14:19 +03:00
committed by GitHub

View File

@ -6,7 +6,7 @@ Use `Array.reduce()` to loop over elements and store indices for matching elemen
Return the array of indices. Return the array of indices.
```js ```js
const indexOfAll = (arr, val) => (arr, val) => const indexOfAll = (arr, val) =>
arr.reduce((acc, el, i) => (el === val ? [...acc, i] : acc), []); arr.reduce((acc, el, i) => (el === val ? [...acc, i] : acc), []);
``` ```