Created
December 8, 2015 20:24
-
-
Save codebubb/810978fdc0bf752ceac2 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
| // Bonfire: Steamroller | |
| // Author: @codebubb | |
| // Challenge: http://www.freecodecamp.com/challenges/bonfire-steamroller | |
| // Learn to Code at Free Code Camp (www.freecodecamp.com) | |
| function steamroller(arr) { | |
| var flattened = []; | |
| function flatten(a){ | |
| return Array.isArray(a) ? a.forEach(flatten) : flattened.push(a); | |
| } | |
| flatten(arr); | |
| return flattened; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment