Last active
December 14, 2016 16:54
-
-
Save pixelis0x/72184704458375cd3676e2d72e2326b0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| var data = [1, [2, [3, 4], 5], 6, [7]]; | |
| function transform(arr) { | |
| return arr.reduce((result,el) => result.concat(Array.isArray(el) ? transform(el) : el), []); | |
| } | |
| console.log(transform(data)); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment