~~~ var arr = [ {name:'腾讯',age:0}, {name:'百度',age:18}, {name:'京东',age:8} ]; ~~~ 降序 ~~~ var newarr=arr.sort(function(a,b){return b['age']-a['age']}) ~~~ 升序 ~~~ var newarr=arr.sort(function(a,b){return a['age']-b['age']}) ~~~