Creating Multi-dimensional Arrays in Javascript


You can create arrays containing other arrays to form multi-dimensional arrays.

Source Code

let matrix = [
  [1, 2, 3],
  [4, 5, 6],
  [7, 8, 9]
];
console.log(matrix[0][1]); // 2
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments