<script language="javascript">
var eidtionTypeList = [
{key:104212,val:"影刻本"},
{key:104211,val:"翻刻本"},
{key:104210,val:"重刻本"},
{key:110,val:"局本"},
{key:109,val:"殿本"},
{key:108,val:"藍印本"},
{key:107,val:"朱印本"},
{key:106,val:"套印本"},
{key:105,val:"活字印本"},
{key:104,val:"刻本"},
{key:103,val:"抄本"},
{key:102,val:"寫本"},
{key:101,val:"稿本"},
{key:100,val:"123123"} ,
{key:100,val:"123123"}
];
1、按key大小排序
eidtionTypeList.sort(function(a,b){return a.key>b.key;});
console.log(eidtionTypeList);
</script>
2、按字符的ASCII码比较
//注意:这里将key转成了字符串类型 eidtionTypeList.sort(function(a,b){return a.key+"">b.key+"";}); console.log(eidtionTypeList);
引用:http://www.cnblogs.com/snandy/archive/2011/03/02/1968580.html