Update pull.md

variable i isn't being used
This commit is contained in:
Sorp
2019-12-24 04:01:00 +01:00
committed by GitHub
parent 106aa89aa0
commit c3cf216bbf

View File

@ -11,7 +11,7 @@ Use `Array.prototype.length = 0` to mutate the passed in an array by resetting i
```js
const pull = (arr, ...args) => {
let argState = Array.isArray(args[0]) ? args[0] : args;
let pulled = arr.filter((v, i) => !argState.includes(v));
let pulled = arr.filter(v => !argState.includes(v));
arr.length = 0;
pulled.forEach(v => arr.push(v));
};
@ -20,4 +20,4 @@ const pull = (arr, ...args) => {
```js
let myArray = ['a', 'b', 'c', 'a', 'b', 'c'];
pull(myArray, 'a', 'c'); // myArray = [ 'b', 'b' ]
```
```