This uses the Haversine formula to calculate the great-circle distance between two points.
distanceLatLng (
latitude1, longitude1, // first coordinates
latitude2, longitude2, // seconds coordinates
diameter // earth diameter (might be any unit)
)
// returns the distance in the specified unit
Created by Martin Kleppe (@aemkei) at Ubilabs.
Check his “JavaScript Golf Lessons“ slides.
See the 140byt.es site for a showcase of entries (built itself using 140-byte entries!), and follow @140bytes on Twitter.