Jakub Szczepaniak, home pagePolski

Flashcards – a simple JavaScript app

The objective is to test your vocabulary. Building this simple game will improve your basic skills and knowledge of JavaScript.

Basic requirements

  1. The app has a hardcoded list of words with their translations.
  2. The app picks a random word from the list and shows the user the original word.
  3. The user enters the translation.
  4. The app checks whether the translation is correct. If it is, the word goes to the list of correct answers; if not, to the list of wrong ones. The app tells the user the result and, after a wrong answer, shows the correct one.
  5. Steps 2–4 repeat until there are no words left.
  6. At the end, the app shows a summary, for example the percentage of correct answers.

Interface, version 1

The app runs in the browser console. This keeps communication with the user simple: the user can type any command, and the app responds with console.log. To do this, create an index.html file that loads a main.js file. index.html explains the commands: open the console (F12), type flashcardsStart() to start the game, and so on. Treat index.html as a README.

Interface, version 2

Once all the requirements are met, build a graphical interface, so anyone can just click and type instead of using the console and learning the commands.

Testing

As this is a “command line” app, it should be fairly simple to test.

Future improvements

  1. Measure the time of each answer.
  2. Load the word list from a separate file. The file can be fetched, or just be a separate JavaScript file.
  3. Wrap the app in an object or a class.
  4. Put the code on your GitHub account, so you benefit from version control and can track your progress.

All notes