[['10','8'],['11','4'],['18','7'],['7','6'],['8','7'],['9','5']]JavaScript 这样的数组怎么弄成 [['7','6'],['8','7'],['9','5'],['10','8'],['11','4'],['18','7']]这样的顺序排列大神
1 回答
HUX布斯
TA贡献1876条经验 获得超6个赞
array = [['10','8'],['11','4'],['18','7'],['7','6'],['8','7'],['9','5']]
function sortNumber(a,b){return a[0]-b[0]}
let newArray = array.sort(sortNumber)
newArray 应该就是你要的结果了
添加回答
举报
0/150
提交
取消