Guest User

Untitled

a guest
Oct 15th, 2018
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.22 KB | None | 0 0
  1. export function flatten(inputArr) {
  2. return inputArr.reduce((outputArr, input) => {
  3. if (Array.isArray(input)) {
  4. return outputArr.concat(flatten(input))
  5. }
  6.  
  7. outputArr.push(input)
  8. return outputArr
  9. }, [])
  10. }
Add Comment
Please, Sign In to add comment