I'm trying to sort by distance of an array of json. I've tried using the .sort() function but I'm unable to make it work. I'm coding in typescript.
sortArr = [
{id: 1, distance: 2.56},
{id: 2, distance: 3.65},
{id: 3, distance: 9.25},
{id: 4, distance: 5.32},
{id: 5, distance: 2.56}
]
sortArr.distance.sort(function(a,b){return a-b;});


