Skip to content

Instantly share code, notes, and snippets.

@Mykola-Veryha
Created April 25, 2022 09:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mykola-Veryha/d03a197affb17ca0c97950a72eea6706 to your computer and use it in GitHub Desktop.
Save Mykola-Veryha/d03a197affb17ca0c97950a72eea6706 to your computer and use it in GitHub Desktop.
const BASE_URL = 'https://countriesnow.space/api/v0.1/countries'
let getCountries = async () => {
const response = await fetch(`${BASE_URL}`).then(response => response.json())
const { data } = response
data.forEach((country) => {
if (names.includes(country.country)) {
console.log(country) // {"country": "Afghanistan", "cities": [ "Herat", "Kabul", "Kandahar", "Molah", ...]}
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment