Created
June 9, 2016 18:47
-
-
Save austbot/3ab71fec5216b342e3b157b583c338b0 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
function flatten(arrInput) { | |
if(arrInput.length < 1 || !arrInput) return []; | |
var arr = []; | |
arrInput.map(function(e, index){ | |
if(Array.isArray(e)) arr= arr.concat(flatten(e)); | |
else arr.push(e); | |
}); | |
return arr; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment