Hi,
I am working on the Show the Local Weather challenge, and cannot seem to get the latitude and longitude calls to return anything. Code pen here: https://codepen.io/mmyshin/pen/KqZvdy
Here’s the code where I declare the variables and call the API.
var lat;
var lng;
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
lat = position.coords.latitude, lng = position.coords.longitude;
});
}
I’m using the Google API to find the location. Console doesn’t show any network errors. Does anybody have any clue as to what is going on? I’ve tried just about everything I can think of and can’t seem to find any help online.
Thanks!