function getDistance(pointA, pointB) {
let getRad = (d) => (d * Math.PI / 180.0);
let radLat1 = getRad(pointA.lat);
let radLat2 = getRad(pointB.lat);
let a = radLat1 - radLat2;
let b = getRad(pointA.lng) - getRad(pointB.lng);
let s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2)));
s = s * 6378137;
return s;
}
let aPoint = { lng: 116.399957, lat: 40.000328 };
let bPoint = { lng: 116.511778, lat: 39.841846 };
let d = getDistance(aPoint, bPoint);