I know that this question has been asked over and over. There are extensive discussions here and here, and a ton of other places online, but I just can't seem to work it out.
I want to store the contents of a gridview in a 2D array in Javascript. I have 4 columns and a varying number (100 to 300) of rows.
I've tried a number of different approaches to create and fill this array. They all take the basic form:
myVar = [ [] ];
myVar = [ [], [], [], [] ];
myVar = new Array([]);
myVar = new Array(new Array());
These are just a few of the approaches I've found and tried, but they either don't work or they only work on rows 0 and 1 (several of the proposed solutions have associated comments that mention this, so I know I'm not imagining it).
Many suggested solutions use loops, and some even use functions, but I can't imagine that this simple task, to create a 2D array, needs to be that complicated.
Can anyone please post simple syntax that creates a 2D array in Javascript, and the syntax to fill it and to access it? Many thanks.