Tuesday, 13 December 2016

How to declare a javascript 2d array

What is the proper way to declare a JavaScript 2d array? I've tried doing this




var matrix = new Array(new Array(2), new Array(2));   


but it doesn't want to work. I am complete javascript beginner so if you can please help me out.
Thanks in advance

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...