方法一:利用數(shù)組的entries方法進(jìn)行排序
function sortArr(arr) {
var goNext = true;
var entries = arr.entries();
while (goNext) {
var result = entries.next();
if (result.done !== true) {
result.value[1].sort((a, b) => a - b);
goNext = true;
} else {
goNext = false;
}
}
return arr;
}
var arr = [[1,2],[4,122,3,222],[4567,1,4,5,6],[34,78,23,1]];
sortArr(arr);