Say I have the following 2x2 array:
var aTest = [
['test00','test01'],
['test10','test11']
]
I can return all of the nested arrays from the first (zero-eth), parent array. i.e.: aTest[0] returns
['test00', 'test01']
However, I can't do the same thing for the nested array without looping. i.e. I would like to do: aTest[][0]:
[['test00'],['test10']]
Am I mistaken? Is there no way to achieve this without loops:
var aTemp = new Array();
for ( var i = 0; i < aTest.length; i++ ) {
aTemp[i] = new Array();
aTemp[i][0] = aTest[i][0];
};
aTemp[i] = [aTest[i][0]];. Also, this will be pretty short with ES6:var aTemp = aTest.map(x => [x[0]]);.