Tag, lint, build

This commit is contained in:
Angelos Chalaris
2017-12-15 12:53:09 +02:00
parent b37d6796f2
commit 6bf0236731
8 changed files with 94 additions and 32 deletions

View File

@ -1,7 +1,8 @@
### Deep flatten array
Use recursion.
Use `[].concat()` and the spread operator `...` to flatten an array, and recursively flatten each element that is an array.
Use `Array.concat()` with an empty array (`[]`) and the spread operator (`...`) to flatten an array.
Rrecursively flatten each element that is an array.
```js
const deepFlatten = arr => [].concat(...arr.map(v => Array.isArray(v) ? deepFlatten(v) : v));