Build README

This commit is contained in:
Angelos Chalaris
2017-12-14 12:18:42 +02:00
parent bddbf98685
commit 78d5fa31f8

View File

@ -10,6 +10,7 @@
## Contents ## Contents
* [Anagrams of string (with duplicates)](#anagrams-of-string-with-duplicates) * [Anagrams of string (with duplicates)](#anagrams-of-string-with-duplicates)
* [Array concatenation](#array-concatenation)
* [Array difference](#array-difference) * [Array difference](#array-difference)
* [Array intersection](#array-intersection) * [Array intersection](#array-intersection)
* [Array union](#array-union) * [Array union](#array-union)
@ -95,6 +96,15 @@ const anagrams = str => {
// anagrams('abc') -> ['abc','acb','bac','bca','cab','cba'] // anagrams('abc') -> ['abc','acb','bac','bca','cab','cba']
``` ```
### Array concatenation
Use `Array.concat()` to concatenate and array with any additional arrays and/or values, specified in `args`.
```js
const ArrayConcat = (arr, ...args) => arr.concat(...args);
// ArrayConcat([1], [1, 2, 3, [4]]) -> [1, 2, 3, [4]]
```
### Array difference ### Array difference
Create a `Set` from `b`, then use `Array.filter()` on `a` to only keep values not contained in `b`. Create a `Set` from `b`, then use `Array.filter()` on `a` to only keep values not contained in `b`.