Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

REST Countries API with Vanilla JS

@theAspiringDev1

Desktop design screenshot for the REST Countries API with color theme switcher coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
  • API
4advanced
View challenge

Design comparison


SolutionDesign

Solution retrospective


Please enlighten me how to change the border country code to its name. Thank you

Community feedback

@EdimarioJr

Posted

The names in the borders array are in the alpha3Code format.

In every country object, there is a field that stores the name of the country in this alpha3Code.

Apply the map method in the border array, iterating over the data from the api to find the countries where the border = alpha3code, and then replace it.

//data is the data from the api

 borders = borders
    .map(
      (current) =>{
        data.forEach((country)=>{
            if( country.alpha3Code === current)
                current = country.name
        })
        return `<a href="detail.html?=${current}"><div class="button">${current}</div></a>`
      }
   )
1

@nasratt

Posted

while searching for the country the alert is really annoying change it to something else; maybe a text message below search field or some message on top of the page.

Great and Nice

0

Please log in to post a comment

Log in with GitHub
Discord logo

Join our Discord community

Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!

Join our Discord