Skip to content

Instantly share code, notes, and snippets.

@seanbrwh
Created December 31, 2018 15:23
Show Gist options
  • Save seanbrwh/de942b5e7b16e7eda17c336c5789d60b to your computer and use it in GitHub Desktop.
Save seanbrwh/de942b5e7b16e7eda17c336c5789d60b to your computer and use it in GitHub Desktop.
let flatten = (arr) => {
return arr.reduce((curr, prev)=>{
return curr.concat(Array.isArray(prev) ? flatten(prev) : prev);
}, []);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment