HLJ 发布于
2018-08-24 15:06:02
52阅读

按键名对数组排序

按键名对数组排序
var data = [ 
  [0.00000979, 1730],
  [0.00000969, 206],
  [0.00000955, 3141],
  [0.00000951, 525],
  [0.00000941, 159],
  [0.0000095, 1000]
]
var sortedData = data.sort((a, b)=>a[0] < b[0]);
console.log(sortedData)
输出结果:
[
  [0.00000979,1730],
  [0.00000969,206],
  [0.00000955,3141],
  [0.00000951,525],
  [0.0000095,1000],
  [0.00000941,159
  ]
]
当前文章内容为原创转载请注明出处:http://www.good1230.com/detail/2018-08-24/208.html
最后生成于 2024-06-22 12:02:52
此内容有帮助 ?
0