I have this kind of dictionary:
const recommendations = { '014A8C3D-FE99-4DE3-9F9F-F197A3CB270F': { zL: 0.0402632597754549, zD: 0, mL: 2, mD: 0, rate: 0.02013162988772745 }, '036EA860-FDF1-40DA-8915-A2F02241DC7D': { zL: 0.0297356539387, zD: 0, mL: 1, mD: 0, rate: 0.0297356539387 }, '4A49B2C5-62A6-494B-BE77-FBEF5C102579': { zL: 0.052390243902439025, zD: 0, mL: 1, mD: 0, rate: 0.052390243902439025 }, '640674E4-5080-4BFD-983F-330D1C9150D0': { zL: 0.011376894745, zD: 0, mL: 1, mD: 0, rate: 0.011376894745 } } Each key is a "recommendation identifier", and each value is a dictionary of recommendation's properties.
I would like to get an array of recommendation Ids, sorted by the 'rate' property (descending order):
//sortedRecommendations ['4A49B2C5-62A6-494B-BE77-FBEF5C102579', '036EA860-FDF1-40DA-8915-A2F02241DC7D', '014A8C3D-FE99-4DE3-9F9F-F197A3CB270F', '640674E4-5080-4BFD-983F-330D1C9150D0'] I guess I should first transform my dictionary (not sortable) into an array (sortable). But then I couldn't find the way to get the expected result...
rateassociated with an id in your sort callback usingrecommendations[id].rate…