I have an Object like this:
let arr ={
1.2 : 44,
55: 41,
13: 59,
2.3 : 77
}
console.log(Object.fromEntries(Object.entries(arr).sort()))
// Result:
// {
// "13": 59,
// "55": 41,
// "1.2": 44,
// "2.3": 77
// }
// Expected Result:
// {
// "1.2": 44,
// "2.3": 77,
// "13": 59,
// "55": 41
// }
The sort function treats keys as string and not floating point numbers.
I've tried Lodash Sort too, but no luck.
Any help would be appreciated.