MCPcopy Create free account
hub / github.com/codemistic/Web-Development / renderCountry

Function renderCountry

CountriesAPI_JS/countries.js:121–138  ·  view source on GitHub ↗
(data, className = '')

Source from the content-addressed store, hash-verified

119//promise =>pending=>setteled-- i)fulfilled-sucessful ii)rejected
120
121const renderCountry = function (data, className = '') {
122 const html = `
123 <article class="country ${className}">
124 <img class="country__img" src="${data.flag}" />
125 <div class="country__data">
126 <h3 class="country__name">${data.name}</h3>
127 <h4 class="country__region">${data.region}</h4>
128 <p class="country__row"><span>👫</span>${(
129 +data.population / 1000000
130 ).toFixed(1)}M people</p>
131 <p class="country__row"><span>🗣️</span>${data.languages[0].name}</p>
132 <p class="country__row"><span>💰</span>${data.currencies[0].name}</p>
133 </div>
134 </article>
135 `;
136 countriesContainer.insertAdjacentHTML('beforeend', html);
137 countriesContainer.style.opacity = 1;
138};
139/*const request = fetch(`https://restcountries.com/v2/name/nepal`); //fetch function return a promise
140console.log(request);
141const getCountryData = function (country) {

Callers 1

getCountryDataFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected