JavaScript数组排序方法

1721
var arr=[112,6,3,77,33,11,4];
arr.sort(function(a,b){return a-b});          
alert(arr.toString());
//二次元
var aa=[];
aa[0]=["4","aa1"];
aa[1]=["3","aa2"];
aa[2]=["1","aa3"];
aa[3]=["2","aa4"];
aa.sort(function(a,b){return a[0]-b[0]});
alert(aa.toString());