I have some data in the format of
[[12, 23],[27,-6],[52, -32],[82, 11]]
[a, b, c, d]
Does such a method exist for referencing the nth element in the nth array in a multidimensional array?
arrayName[x] gives us the reference to the array at position
[y] gives us the element at position
y of that array.
Also, if such a method exists, does it also apply to jagged arrays?
Gratuitous Live Example:
var arrayName = [[12, 23],[27,-6],[52, -32],[82, 11]]; var x = 2; // The third array in 'arrayName' var y = 1; // The second entry in that array snippet.log(arrayName[x][y]);
<!-- Script provides the `snippet` object, see http://meta.stackexchange.com/a/242144/134069 --> <script src="//tjcrowder.github.io/simple-snippets-console/snippet.js"></script>