Created
January 9, 2020 12:47
-
-
Save EnetoJara/97fac88cbfa5067c5f27c1385476b125 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const flat = (base, val) => Array.isArray(val) ? base.concat(val.reduce(flat, [])) :base.concat(val); | |
const map = arr => arr.reduce(flat, []); | |
console.log(map([1,23,[3,[3,1,[3,4],5],6],5])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment