I have an object which has 2 attributes - latitude and longitude. I want to get the nearest match from the object array by considering both attributes.
obj = {latitude: 55.87, longitude: 4.20}
[
{
"latitude": 55.85,
"longitude": 4.22
},
{
"latitude": 55.89,
"longitude": 4.16
},
{
"latitude": 55.88,
"longitude": -4.24
}
]
I need to get the array index which is closest match.