I want to build a website using 2 API's. I've made 2 separate Classes for each api. I need to get 'data.currently.icon' outside getWeather() and class Weather. I was trying everything variables outside scope, getters&setters. How can I solve it?
class Weather {
  constructor() {
    this.getLocation();
    this.lat;
    this.lng;
    this.icon;
  } // end constructor
  getLocation() {
    navigator.geolocation.getCurrentPosition(
      this.myLocation.bind(this),
      this.errorLocation.bind(this)
    );
  }
  myLocation(result) {
    this.lat = result.coords.latitude;
    this.lng = result.coords.longitude;
    //console.log(this.lat);
    this.getWeather();
  }
  getWeather() {
    let url = `https://cors-anywhere.herokuapp.com/https://api.darksky.net/forecast/15684c4ffc14f32fcd28af8aa81bc818/${this.lat},${this.lng}?units=si`
    fetch(url).then(response => {
      //get json 
      return response.json();
    }).then(data => {
      document.querySelector('#test').innerHTML = data.currently.summary;
      document.querySelector('#test2').innerHTML = data.currently.temperature + "deg";
      //data.currently.icon
    }).catch(err => {
      console.log(err);
    });
  };
  errorLocation(err) {
    console.log(err);
  }
} // end class Weather
let weather = new Weather();
console.log(icon);
 
    