Javascript : Sort array of object programmatically
This question already has an answer here:
使用sort
方法:
array = array.sort( function(a,b) {
if (a.name > b.name) {
return 1;
}
if (a.name < b.name) {
return -1;
}
return 0;
});
链接地址: http://www.djcxy.com/p/19346.html
上一篇: 在数组的开头部署JavaScript元素