Answer the question
In order to leave comments, you need to log in
How to use the data from this script?
There is a script that determines the coordinates and city of the user.
ymaps.ready()
.then(() => ymaps.geolocation.get({autoReverseGeocode: false})
.then(res => res.geoObjects.get(0).geometry.getCoordinates()))
.then(ll => ($('#latlng').append(`Координаты: ${ll}`), ymaps.geocode(ll)))
.then(res => res.geoObjects.get(0).getLocalities())
.then(city => $('#city').append(`${city}`))
.catch(err => $('#err').append(`Ошибка: ${err}`))
if (city == 'Москва') {
} else {
}
Answer the question
In order to leave comments, you need to log in
do console.log(city);
it and see what's real. I understand there is an object, not a string
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question