Created
April 25, 2022 09:30
-
-
Save Mykola-Veryha/d03a197affb17ca0c97950a72eea6706 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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