Build README
This commit is contained in:
@ -5,6 +5,6 @@ Use `reduce()` to get all elements that are not arrays, flatten each element tha
|
||||
|
||||
```js
|
||||
const deepFlatten = arr =>
|
||||
arr.reduce( (a, v) => a.concat( Array.isArray(v) ? flatten(v) : v ), []);
|
||||
arr.reduce( (a, v) => a.concat( Array.isArray(v) ? deepFlatten(v) : v ), []);
|
||||
// deepFlatten([1,[2],[[3],4],5]) -> [1,2,3,4,5]
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user