update snippets 0-All

This commit is contained in:
Stefan Feješ
2017-12-25 14:49:52 +01:00
committed by Agamemnon Zorbas
parent 6bedb8fba4
commit 0c129cdd02
33 changed files with 166 additions and 74 deletions

View File

@ -8,6 +8,9 @@ Create a `Set` from each array, then use `Array.filter()` on each of them to onl
const symmetricDifference = (a, b) => {
const sA = new Set(a), sB = new Set(b);
return [...a.filter(x => !sB.has(x)), ...b.filter(x => !sA.has(x))];
};
// symmetricDifference([1,2,3], [1,2,4]) -> [3,4]
}
```
```js
symmetricDifference([1,2,3], [1,2,4]) -> [3,4]
```