Categories
interview

2D Array JavaScript (ES6)

const twoDarray = Array(3).fill(0).map(x => Array(3).fill(0));

console.log(twoDarray);
// [[0, 0, 0], [0, 0, 0], [0, 0, 0]]

Demo