When I run this, the variable elevationPoint is undefined on the first alert.  I noticed by accident that it works on the second alert. Why is that?
var elevator = new google.maps.ElevationService();
var coordinates = new google.maps.LatLng(closestLat , closestLng);
var pointElevation;
elevator.getElevationForLocations({
    'locations':[coordinates]
    }, function (results, status) {
    if (status == google.maps.ElevationStatus.OK) {
        // Retrieve the first result
        if (results[0]) {
            pointElevation = results[0].elevation;
           
        } else {
            alert('No results found');
        }
    }
    else {
        alert('Elevation service failed due to: ' + status);
    }
});
alert(pointElevation);
alert(pointElevation); 
     
    