var n = 4, m = 4; var mas = []; for (var i = 0; i < m; i++){ mas[i] = []; for (var j = 0; j < n; j++){ mas[i][j] = 0; }} console.log(mas);