# [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');
```

![consuming.PNG](https://cdn.hashnode.com/res/hashnode/image/upload/v1660318628625/qBf_8dGbp.PNG align="left")



