I am trying to access JSON data retrieved from JSON-Server within a function outside the function scope for the past 3 hours with no luck, below is my Code:
http.get(`http://localhost:3000/${depairport}`)
  .then(data => airportNav(data))
  .catch(err => console.log(err));
  var number1 = 1.0;
  var number2 = 2.0;
  var airportNav = function calculateDepNav(depNav){
    number1 = depNav.lat;
    number2 = depNav.lon;
    return number1, number2;
  }
console.log(number1, number2);
How should I access depNav outside of this scope?
