Skip to content

Instantly share code, notes, and snippets.

@greathmaster
Created October 11, 2019 16:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save greathmaster/bd048bd762ec6db4a20d48490b7d7e8c to your computer and use it in GitHub Desktop.
Save greathmaster/bd048bd762ec6db4a20d48490b7d7e8c to your computer and use it in GitHub Desktop.
Fill/initialize a 2D JS array
//Fill/initialize a 2D JS array
//From: https://www.quora.com/In-JavaScript-how-do-you-create-an-empty-2D-array
var twoDArray = Array(2).fill(null).map(()=>Array(2).fill(null));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment