How to determine entered the city or not?

Writing a game in html/css/js in the City. Faced with a problem: how to determine entered the city or not? Maybe there is some kind of API or library, or you can check the HTTP request?
June 7th 19 at 14:43
1 answer
June 7th 19 at 14:45
The most simple
<input style="text-transform: uppercase;">
<button onclick="city();">Add</button>
the <script>
var inCity = document.body.children[0];
var arrCity = [];
function city(){
 var yn = arrCity.indexOf(inCity.value);
 if(yn >= 0){
 alert('This city' d');
}else{
arrCity.push(inCity.value);
 alert('city racing');
}
}
</script>
The question was not that. To check if the city already named, I wouldn't be a problem at all. It is necessary to implement the test: is there such a city at all. To exclude different Putingrad. To connect to a certain API and see if there is any city in the world. Here, proposed options for geocoding. But the question is how to implement it? - theodore6 commented on June 7th 19 at 14:48

Find more questions by tags JavaScriptNode.js