Here is a multiple choice code quiz about JavaScript. Using localStorage to set and get users results.
The criteria for this is as follows:
- Upon clicking "Start Quiz" the game starts.
- A timer starts counting down, if it hits 0, game over.
- User answers 1 question at a time.
- After each answer, it displays if you selected the correct or incorrect answer, relevant sound plays to let user know the result.
- After all questions have been answered or time hits 0, user inputs their initials (max 3 characters).
- Score and user initials are stored to local storage.
- Highscore page loads up with user scores displayed in a list.
The website can be accessed here
How to play the game:
- Open the link up in the browser.
- Click "Start Quiz" button.
- Answer each question, 1 at a time.
- When quiz ends, input your initials (max 3 characters).
- Click "Submit" button. This will redirect you to the highscores page and show your current highscores.
- Click "Go Back" button to try again or click "Clear Highscores" button to clear all existing scores.
Here are a few references that helped me to further understand localStorage, sort() method and how to add audio to the game.
-
To further understand how to use localStorage.
-
How to sort highscores order using the sort() method.
-
How to add audio files to webpage - w3schools.
Please refer to the LICENSE in the repo.