SHARE
TWEET

Untitled

a guest Oct 16th, 2019 95 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var arr1 = [1, 2, [3, 4]];
  2. arr1.flat();
  3. // [1, 2, 3, 4]
  4.  
  5. var arr2 = [1, 2, [3, 4, [5, 6]]];
  6. arr2.flat();
  7. // [1, 2, 3, 4, [5, 6]]
  8.  
  9. var arr3 = [1, 2, [3, 4, [5, 6]]];
  10. arr3.flat(2);
  11. // [1, 2, 3, 4, 5, 6]
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