Merge pull request #1062 from sorp92/master

[FIX] Update pull.md
This commit is contained in:
Angelos Chalaris
2019-12-24 08:08:10 +02:00
committed by GitHub

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' ]
```
```