My problem is that when I print the lat and long of my position to the console it works but when I pass them to my calculate function the console says they are undefined.
function getLocation() {
    if (navigator.geolocation) {
        navigator.geolocation.getCurrentPosition(showPosition);
    } 
    else {
        location.innerHTML = "Geolocation is not supported by this browser.";
    }
}
function showPosition(position) {
    console.log(position.coords.longitude); 
    var lat = position.coords.latitude;
    var lng = position.coords.longitude;
}
function calculate(lat,lng){
    var homeCoord = new Array();
    var awayCoord = new Array();
    console.log(lng);
    console.log(lat);
    homeCoord[0] = lat;
    homeCoord[1] = lng;
    awayCoord = myGeocodeFirst();
    var combinedLat = homeCoord[0]+awayCoord[0];
    var combinedLong = awayCoord[1]+homeCoord[1];
    console.log(combinedLat+" "+combinedLong);
}
Thanks for the help!
 
    