//对数组中的多个对象对某一个字段按照字母先后顺序排序
var array = [
{"id":"111","user":"D"},
{"id":"222","user":"B"},
{"id":"111","user":"A"},
{"id":"333","user":"C"},
{"id":"444","user":"F"},
{"id":"555","user":"E"}
];
//对数组中的user字段进行排序
arr.sort(function(a,b){
return a.user.localeCompare(b.user)
});
//排序后的结果
var array = [
{"id":"111","user":"A"},
{"id":"222","user":"B"},
{"id":"333","user":"C"},
{"id":"111","user":"D"},
{"id":"555","user":"E"},
{"id":"444","user":"F"}
];
转载[js 数组中的值排序](https://www.cnblogs.com/yydxh/p/13748766.html)