I wanted to store Latitude and Longitude in 2 different variables so that it can be used in another api request in javascript
let weather={
key:"your api key",
getweather(city){
fetch(`https://api.openweathermap.org/data/2.5/forecast?
q=${city}&appid=${this.key}&units=metric`)
.then(res => res.json())
.then(data => this.show(data))
const encodeurl=encodeURI(fetch);
},
show(data){
**const{lat,lon}=data.city.coord;**
console.log(lat,lon);
}
}
weather.getweather("mumbai");