Stuck On Show the Local Weather project

Stuck On Show the Local Weather project
0

#1

Hi!
My work Show the Local Weather project is stopped

step 1
I would like replace my gps coord latitude & longitude to variable
var apisrc = “https://fcc-weather-api.glitch.me/api/current?lat=” + latitude + “&” + “lon=” + longitude;

with standard function from MDN


var latitude="";
var longitude="";

function geoFindMe (){
    if (!navigator.geolocation){
        console.log("Geolocation is not supported by your browser");

    }

    function success(position) {
         latitude  = position.coords.latitude;
         longitude = position.coords.longitude;
        console.log('Latitude is ' + latitude + 'Longitude is ' + longitude )
    };

     function error() {
        console.log("Unable to retrieve your location")
    };



    navigator.geolocation.getCurrentPosition(success, error)
}

geoFindMe();

// does not work properly :(
console.log('latitude is '+latitude+'longitude is '+ longitude)


But geoFindMe() does not work properly.

Help me please.


#2

replce

with

"

at this line

console.log(“Geolocation is not supported by your browser”);


#3

I’ve edited your post for readability. When you enter a code block into the forum, remember to precede it with a line of three backticks and follow it with a line of three backticks to make easier to read. See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.


#4

I found workaround . Almost done