var ajson=
{
"result":[
{
"cid":1,
"name":"aaa",
"price":1000
},{
"cid":2,
"name":"bbb",
"price":150
},{
"cid":3,
"name":"ccc",
"price":200
},{
"cid":4,
"name":"ddd",
"price":1500
},{
"cid":5,
"name":"eee",
"price":1100
}
],
"totalCount":5
} function sortJ(a,b){
return a.price-b.price;
};
var data=
ajson.result.sort(sortJ); console.log(data);

参考:

https://www.cnblogs.com/angle-happy/p/5917109.html

http://www.jb51.net/article/48941.htm

05-11 19:56