Your example where you had myArray = [[1,2,3],[4,5,6],[7,8,9]] and wanted to retrieve [[2,3],[5,6],[8,9]]
you could do something like this:
var myArray = [[1,2,3],[4,5,6],[7,8,9]];
var results = [];
for(var i = 0; i < myArray.length; i++){
results.push(myArray[i].slice(1,3));
}
//results === [[2,3],[5,6],[8,9]];
If you want to slice the indexes after index[0] from each sub-array, then you might want to go with this approach instead:
var myArray = [[1,2,3],[4,5,6],[7,8,9]];
var sliceSubset = function(array){
var results = [];
for(var i = 0; i < array.length; i++){
results.push(array[i].slice(1,array[i].length));
}
return results;
}
sliceSubset(myArray); //returns [[2,3],[5,6],[8,9]]
//works on different sized arrays as well
var myOtherArray = [[1,2,3,9],[4,5,6],[7,8,9]];
sliceSubset(myOtherArray); //returns [[2,3,9],[5,6],[8,9]]
myArray = [[1,2,3],[4,5,6],[7,8,9]]