Hey, I’m working on “Show the Local Weather” task.
I’ve already defined all the variables but in this function, I cannot return the value of urlString.
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition);
} else {
console.log("Geolocation is not supported by this browser");
}
function showPosition(position) {
var lat = "lat=" + position.coords.latitude;
var lon = "lon=" + position.coords.longitude;
var urlString = api + lat + "&" + lon + "&appid=" + apikey;
return urlString
}
console.log(showPosition);
How to return this value?
Thanks 