Update indexOfAll description

forgot to update description
This commit is contained in:
Robert Mennell
2018-01-08 13:27:45 -08:00
committed by GitHub
parent 949dbb6196
commit dedd2fdd0b

View File

@ -1,9 +1,9 @@
### indexOfAll ### indexOfAll
Returns all indices of `val` in an array. If `val` never occurs, returns `[-1]`. Returns all indices of `val` in an array. If `val` never occurs, returns `[]`.
Use `Array.forEach()` to loop over elements and `Array.push()` to store indices for matching elements. Use `Array.forEach()` to loop over elements and `Array.push()` to store indices for matching elements.
Return `[-1]` if `length` of the array of indices is `0`, otherwise return the array of indices. Return the array of indices.
```js ```js
const indexOfAll = (arr, val) => { const indexOfAll = (arr, val) => {