This is a web game taken from devchallenges.io 🕹
-
Using promises, it fetches data using the REST Countries API.
-
It randomly selects one country out of every single one received in JSON and one out of three types of questions available for the game.
-
It formulates the question with the chosen country, and it choses another 3 countries that are wrong answers.
-
It randomly prints these 4 countries into the game.
-
If you click the right answer, you gain 1 point and repeat the process. Your points get restarted when you lose.
-
Extra: It encapsulates the selected country and the type of question in a closure instead of having them in the global scope, just to be sure to not letting cheating so easy..
https://realdiegor.github.io/Country-quiz/
If you have any feedback, please reach out to me at [email protected]