Skip to content

Instantly share code, notes, and snippets.

Avatar

Matt Walterspieler walterspieler

View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am walterspieler on github.
  • I am mwalterspieler (https://keybase.io/mwalterspieler) on keybase.
  • I have a public key ASBfGz9PXaqPTreYdoOLLVndQejLW2jbxGgYKoFguTyucQo

To claim this, I am signing this object:

View using-Array.prototype.flat().js
const multiDimensionalArray = [ [1, 2], [3, 4], [5, 6] ];
const flattenedArray =multiDimensionalArray.flat();
console.log(flattenedArray) // [1, 2, 3, 4, 5, 6]
// This methods accepts one argument to choose the depth of the flattening.
const multiDimensionalArray = [[ [1, 2]], [3, 4], [5, 6] ];
multiDimensionalArray.flat(2);
console.log(flattenedArray) // [1, 2, 3, 4, 5, 6]
You can’t perform that action at this time.