I have 2 lists/arrays:
[Examples]:
let labels = ["John", "Sophie", "Hannah", "Emilia"]
let data = [10, 40, 24, 25]
I want to sort both arrays with the order of data. (Each name corresponds with the value in the other array at the same index). I would use an object like this {name: value} but for my needs, they have to be seperate (at least the result). I have found a solution but i find it isnt very elegant.
[Desired Output Example]:
let data = [40, 25, 24, 10]
let labels = ["Sophie", "Emilia", "Hannah", "John"]
basically the other array has to be sorted with the same pattern that the data array will be sorted (numbers ascending)