1.number类型排序 let aa = [1,11,2,4,3] aa.sort() console.log(aa) //[1,11,2,3,4] aa.sort((a,b)=>a-b) console.log(aa) //[1,2,3,4,11] 2.根据对象某一属性排序 let bb = [{age:1},{age:11},{age:2},{age:4},{age:3}] bb.sort((a,b)=>a.age-b.age) console.log(bb) //[{age:1},{a…