Open swati-jagtap opened 3 years ago
const countriesAPI = 'https://restcountries.eu/rest/v2/all' /* const fetchData = async () => { try { const response = await fetch(countriesAPI) const countries = await response.json() console.log(countries) } catch (err) { console.log(err) } } console.log('===== async and await') fetchData() */ fetch(countriesAPI) .then(response=>response.json()) .then(data=>{ for(const d of data){ console.log("Name Of Country :",d["name"]) console.log("Capital:",d["capital"]) console.log("Languagds :",d["languages"]) console.log("Population :",d["population"]) console.log("Area:",d["area"]) console.log(" ") } // console.log(data[1]["name"]) })