if ('geolocation' in navigator) {
navigator.geolocation.getCurrentPosition(setPosition, showError);
}else {
alert('doesnt support');
}
function setPosition(position) {
let latitude = position.coords.latitude;
let longitude = position.coords.longitude;
getWeather(latitude, longitude);
}
function showError(error) {
alert('error', error.message);
}