empty 2d array in js code example
Example: javscript generate empty 2d array
var grid = [...Array(width)].map(e => Array(height));
// access via grid[y][x]
var grid = [...Array(width)].map(e => Array(height));
// access via grid[y][x]