I am receiving weird response from 3rd party api , that looks like below
{ "27000CE": -1, "27100CE": 2, "27300CE": -1, "27200CE": 5 } How do I sort this by value ?
like ascending or descending.
{ "27300CE": -1, "27000CE": -1, "27100CE": 2, "27200CE": 5 } I tried something like below
sortArrayOfObjects = (arr, key) => { return arr.sort((a, b) => { return a[key] - b[key]; }); }; But all keys are different and thats the problem.