Update pull.md
variable i isn't being used
This commit is contained in:
@ -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' ]
|
||||
```
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user