REST Countries API with color theme switcher
Design comparison
Solution retrospective
I have worked on this project with the help of the Youtuber Florin Pop, i have a general idea of what working with api's is, async functions, and embedding in es6.
One question: When you want to display the borders countries(using .borders property) the api gives you back some three letter abbreviation of the full name, how can i turn that into the full name, any help?
Thank you
Community feedback
- @VincenzoMarcovecchioPosted over 4 years ago
countries = is my res.json() how can i filter from that for each of those alpha 3 code thank you i'm on the tutorials anyway :)...
0 - @VincenzoMarcovecchioPosted over 4 years ago
I'm trying to create a function i know i'm really bad at it :)
const borders = country.borders; const fullName = for(let border of borders){ let name = border.name //i know this is wrong return name });
0@gomezlucasPosted over 4 years ago@vinceoldmark I kind of understand what you are trying to achieve. you get inside country borders an Array with the codes of those countries. Let's say [arg, col, bra]. So border.name is going to be undefined since that information is not in country. So you either keep an array with the countries-object and filter from it. Or do "fetches" asking for the codes you have inside that array. Hope it make sense. Ask me again otherwise :)
1 - @umutbozdagPosted over 4 years ago
You have to fetch those letters from api like this: https://restcountries.eu/rest/v2/alpha/COL and then get the actual names of those countries
0@umutbozdagPosted over 4 years ago@umutbozdag Or maybe you could filter the array depending the country code.
0
Please log in to post a comment
Log in with GitHubJoin 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