[Solved] Sort an array of arrays by key


This in invalid syntax, you are mixing array and object syntax:

[ '0.00000979': 1730,
  '0.00000969': 206,
  '0.00000955': 3141,
  '0.00000951': 525,
  '0.00000941': 159,
  '0.0000095': 1000,
]

To be able to sort, you need a valid array, actually an array of arrays:

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)

Check the documentation of the sort() method

1

solved Sort an array of arrays by key