Case study — Trivia Game · Web App
QuizMaster
QuizMaster is a timed trivia game. Players enter their name, choose a category, a difficulty and the number of questions, then race a 15-second clock on each question. Scores are saved to a top-10 leaderboard on their device.
- Role
- Front-End Developer
- Year
- 2026
- Context
- Personal project
- Services
- Interactive App · API Integration · Game Logic
- Stack
- JavaScript (ES Modules) · OOP · Open Trivia DB API · CSS3 · LocalStorage
- Live site
- aseelmahmoud115.github.io/Quiz-App

Live build — hover to pan
01
The Challenge
A quiz looks simple, but a good one has many moving parts: questions arriving from an API, a timer that must stop at the right moment, answers that must be checked once and only once, and a score that persists between games.
02
The Approach
Model the game in two classes with clear responsibilities: Quiz owns the game state — settings, score, progress and high scores — while Question owns one question's rendering, timer and answer checking.
03
The Design
A neon, game-like theme with a hexagon background, bold display type and clear feedback: correct and wrong answers are highlighted, and a “time's up” message appears when the clock runs out.
04
The Development
ES modules split the code into quiz.js, question.js and ui-controls.js. The Open Trivia DB API is called with the chosen category, difficulty and amount; answers are shuffled and HTML entities in questions are decoded with DOMParser.
Players can answer with the mouse or with keys 1–4, start the game with Enter, and see helpful messages if the setup form is incomplete. Loading and error states cover the API call.
05
The Hardest Part
The tricky part was the timer and the event listeners. If a player answered at the same moment the clock ran out, or a keyboard listener from a previous question was still active, the same answer could be counted twice.
Each Question now starts its own interval and removes its own listeners when it ends — whether by an answer or by time running out — and marks itself as answered so any second action is ignored.
06
The Performance
With no framework and no build step the game loads instantly. High scores are kept in LocalStorage, sorted, trimmed to the top ten and read safely inside try/catch.
07
The Result
A polished, replayable game that shows clean object-oriented JavaScript in action. It is live on GitHub Pages.
Services behind this project
Next Step
Have an idea worth building?
Let's turn it into an interface people remember — fast, responsive and built to last.
Usually replies within a day · Gaza, Palestine · working remotely worldwide
View my work

