daily pastebin goal
65%
SHARE
TWEET

Untitled

a guest Jan 23rd, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const flatten = function(arr, res = []) {
  2.   for (let n = 0, length = arr.length; n < length; n++) {
  3.     const value = arr[n];
  4.     if (Array.isArray(value)) {
  5.       flatten(value, res);
  6.     } else {
  7.       res.push(value);
  8.     }
  9.   }
  10.   return res;
  11. };
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