(lattitude, longitude)
| 1 | const getlocation = function (lattitude, longitude) { |
| 2 | fetch(`https://geocode.xyz/${lattitude},${longitude}?geoit=json`) |
| 3 | .then((respose) => respose.json()) |
| 4 | .then((data) => { |
| 5 | console.log(data); |
| 6 | console.log( |
| 7 | ` the country name is ${data.country} and city is ${data.city}` |
| 8 | ); |
| 9 | }); |
| 10 | }; |
| 11 | getlocation(27.7172, 85.324); |