I have been reading online and some places say it isn\'t possible, some say it is and then give an example and others refute the example, etc.
How do I dec
There is another solution, that does not force you to pre-define the size of the 2d array, and that is very concise.
var table = {}
table[[1,2]] = 3 // Notice the double [[ and ]]
console.log(table[[1,2]]) // -> 3
This works because, [1,2]
is transformed into a string, that is used as a string key for the table
object.