create 2d array in javascript with empty arrays 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]