I have this array of pairs in JS :
var my_array = [['line_1','2'],['line_2','3'],['line_3','5'],['line_4','1'],['line_5','4'],]
I would like to sort this array by values and then create a new array with only the sorted keys.
Expected result :
['line_4','line_1','line_2','line_5','line_3']
I tried to sort by using this :
var my_sorted_array = Object.values(my_array).sort((a, b) => a[1] - b[1])
But I don’t know how to do the final step and I assume there is a better way to do this in pure JS.
Thanks
1