Update flatten.md

This commit is contained in:
Angelos Chalaris
2018-01-11 10:56:14 +02:00
committed by GitHub
parent 498fe17977
commit b2628f8ff3

View File

@ -5,7 +5,7 @@ Flattens an array up to the specified depth.
Use recursion, decrementing `depth` by 1 for each level of depth.
Use `Array.reduce()` and `Array.concat()` to merge elements or arrays.
Base case, for `depth` equal to `1` stops recursion.
Omit the second element, `depth` to flatten only to a depth of `1` (single flatten).
Omit the second argument, `depth` to flatten only to a depth of `1` (single flatten).
```js
const flatten = (arr, depth = 1) =>