Created
July 27, 2017 02:51
-
-
Save Lavioli/7bcdf9df33162f98358d5a0b6c9a311d 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
//solution | |
function flattenArr(arr) { | |
var result = []; | |
arr.forEach(function(e) { | |
if(Array.isArray(e)) { | |
result = result.concat(flattenArr(e)); | |
} else { | |
result.push(e); | |
} | |
}); | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment