@Mod8124
Posted
Hello Well done!
Your code is hard to read, first, always put all your variables on the top of the file especially if you use const
to avoid hoisted also if you async and await
always use try and catch
what would happen if the API failed your app too so you need to handle that.
Also, it's kinda confusing what is this
capital = [],
languages = [],
currencies = [],
tld = [],
borders = [];
And the first look Idk what are these variables, it's better to implement if you use this
const country = {
capital = [],
languages = [],
currencies = [],
tld = [],
borders = [];
}
Now I Know all these variables are about the country, if you want to see more good practices and legible code you can see clean-code-javascript
I hope it helps you, Good coding 🤟
Marked as helpful
@Kaipi01
Posted
@Mod8124 I actually forgot error handling when retrieving API data 😅. Thank you very much for your comment. It’s very valuable to me. In the future, I will try to avoid these mitakes and try to write more readable code.