This is a solution to the REST Countries API with color theme switcher challenge on Frontend Mentor. Frontend Mentor challenges help you improve your coding skills by building realistic projects.
Users should be able to:
input
fieldLearn more depth of an api, Toggle dark mode and light mode.
This is my favorite journey:
function specificData() {
for (let i = 0; i < country.length; i++) {
const languageCode = Object.keys(country[i].name.nativeName)[0];
const nativeName = country[i].name.nativeName[languageCode].common;
const currenciesCode = Object.keys(country[i].currencies);
const currencies = country[i].currencies[currenciesCode]?.name || '-';
const languages = country[i].languages[languageCode];
return { nativeName, currencies, languages };
}
}
Im curious with using IntersectionObserver for this challenge, i tried a lot of way, but its does not work. Also i don't like the way i code the color theme switcher, it does not look good.