Skip to content

Instantly share code, notes, and snippets.

@codebubb
Created December 8, 2015 20:24
Show Gist options
  • Select an option

  • Save codebubb/810978fdc0bf752ceac2 to your computer and use it in GitHub Desktop.

Select an option

Save codebubb/810978fdc0bf752ceac2 to your computer and use it in GitHub Desktop.
// 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