/*一维数组排序*/
var arr=[12,3,34,5,2]
var arr1=arr.sort((a,b) => {
return a-b;
})
console.log(arr1);
/*二维数组排序*/
var arr = [[1,34],[456,2,3,44,234],[4567,1,4,5,6],[34,78,23,1]];
function sortArray(arr){
var goNext=true;
var entries=arr.entries();
while(goNext){
var result = entries.next();
if(result.done!=true){
console.log(result.value)
result.value[1].sort((a,b)=>a-b);
goNext=true;
}else{
goNext=false;
}
}
return arr;
}
console.log(sortArray(arr));