Skip to content

Instantly share code, notes, and snippets.

@jgabriellima
Created December 11, 2017 17:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jgabriellima/4f35b98ef2737787634b0430257c9e4a to your computer and use it in GitHub Desktop.
Save jgabriellima/4f35b98ef2737787634b0430257c9e4a to your computer and use it in GitHub Desktop.
function flatten(data){
return [].concat.apply([],[].concat.apply([],data))
}
var result = flatten([[1,2,[3]],4]);
console.log(result);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment