I want to sort array/object of cities based on my location from nearest (to my location) to furthest
I have list of locations that i get from database How would i solve this using javascript and HTML5 geolocation?
I have something like this: example :
var locations= [{"name":"location1" "latitude" :"31.413165123"
"longitude":"40.34215241"},{"name":"location2" "latitude" :"31.413775453"
"longitude":"40.34675341"}]
and I want to sort those location by nearest to my location