Skip to content

Instantly share code, notes, and snippets.

@remyhunt
Last active March 20, 2020 01:17
Show Gist options
  • Save remyhunt/97c0a3c7914319e277ae to your computer and use it in GitHub Desktop.
Save remyhunt/97c0a3c7914319e277ae to your computer and use it in GitHub Desktop.
flatty
function flatten(arrayArg) {
var result = []
for (var i = 0; i < arrayArg.length; i++){
if(arrayArg[i] instanceof Array)
result = result.concat(flatten(arrayArg[i]))
else
result = result.concat(arrayArg[i])
}
return result
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment