0

I'm new to javascript arrays. How can I create such a matrix?

[0, 1]
[3, 2]
[4, 5]
[6, 7]
[8, 9]
beaker
  • 16,331
  • 3
  • 32
  • 49

1 Answers1

1

A matrix is an array of arrays so just put those arrays into another array, assign it to a variable and you're ready to start using it in any way you want:

let matrix = [
   [0, 1],
   [3, 2],
   [4, 5],
   [6, 7],
   [8, 9]
];
Saul Martinez
  • 114
  • 11