WEATHER APP Pt. 3/3 (icons! Button!) | FreeCodeCamp Intermediate Front-End projects

Опубликовано: 14 Февраль 2026
на канале: CodeWithNick
5,522
74

Native (and better) way to get latitude&longitude (thanks +missfleur, also see in comments)

if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function (position) {
console.log(position) // object that contains latitude and longitude, among other things
});
});

this can be used in place of ipinfo.io, just do the rest as is in the getCurrentPosition callback function