[JavaScript] Asynchronous JavaScript: Promises, Async/Await, and AJAX - Consuming Promises
// const request = fetch(`https://restcountries.com/v2/name/portugal`);
// console.log(request);
// const getCountryData = function (country) {
// fetch(`https://restcountries.com/v2/name/${country}`)
// .then(function (response) {
// console.log(response);
// return response.json();
// })
// .then(function (data) {
// console.log(data);
// renderCountry(data[0]);
// });
// };
const getCountryData = function (country) {
fetch(`https://restcountries.com/v2/name/${country}`)
.then(response => response.json())
.then(data => renderCountry(data[0]));
};
getCountryData('Spain');
getCountryData('usa');