diff --git a/README.md b/README.md index 640da6cd9..6dff38d61 100644 --- a/README.md +++ b/README.md @@ -153,7 +153,7 @@ 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] ```