Skip to content

Instantly share code, notes, and snippets.

@pratyushcrd
Last active January 13, 2018 13:11
Show Gist options
  • Save pratyushcrd/02c48a5a9d0aba2393662910b0d7ca9e to your computer and use it in GitHub Desktop.
Save pratyushcrd/02c48a5a9d0aba2393662910b0d7ca9e to your computer and use it in GitHub Desktop.
const flatten = arr => arr
.reduce((a, b) => a.concat(b))
// Execution
flatten([
[1, 2, 3],
[4, 5],
[6]
])
Output : [1, 2, 3, 4, 5, 6]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment