daily pastebin goal
25%
SHARE
TWEET

Untitled

a guest Oct 15th, 2018 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top