DevPrep
  • Interview Prep
  • Projects
  • Resources
  • Pricing
  • About Us
Submit Question
DevPrep
  • Pricing
  • About Us
Submit Question
← From Beginner to Expert in Fundamentals of Frontend
  • Project 1: The Performance-First Dashboard
  • Project 2: Accessible Video Player
  • Project 3: Markdown Blog Engine
  • Project 4: Browser-Based Code Editor
  • Project 5: Multi-Tab Whiteboard
  • Project 6: Infinite Scroll Image Gallery
  • Project 7: Recipe Optimizer & Converter
  • Project 8: Budget Tracker with Charts
  • Project 9: Typing Speed Test
  • Project 10: Weather App with Time-Travel
  • Project 11: CSS Grid Layout Builder
  • Project 12: Password Vault (Frontend Only)
  • Project 13: Kanban Board (Trello Clone)
  • Project 14: Quiz App with Leaderboard
  • Project 15: Habit Tracker (GitHub Style)
  • Project 16: E-commerce Product Page
  • Project 17: Unit Converter (Expert Mode)
  • Project 18: Music Visualizer
  • Project 19: Flashcard Learning App
  • Project 20: Custom Form Validator
  • Project 21: Virtual Terminal
  • Project 22: Pomodoro Timer (Focus Pro)
  • Project 23: SVG Path Editor
  • Project 24: Movie Database Matchmaker
  • Project 25: Interactive Resume / Portfolio
  • Project 26: Recipe Scraper UI
  • Project 27: Crypto Tracker (Real-Time)
  • Project 28: Find My Pet (PWA)
  • Project 29: Markdown-to-Slide Tool
  • Project 30: Browser Health Dashboard
← From Beginner to Expert in Fundamentals of Frontend

Project 14: Quiz App with Leaderboard

35 min read
Fisher-Yates ShuffleState MachinesTimer UXScoring SystemsLocalStorage LeaderboardSocial Sharing

📋 Project Brief

Build a gamified trivia quiz application with timed questions, a streak-based scoring system, and a local leaderboard. This project focuses on state machines, timer pressure UX, and fair randomization algorithms.

✅ Feature Requirements

Feature 1: Fisher-Yates Shuffle

Acceptance Criteria:

  • Questions appear in a random order each time the quiz starts
  • Answer options within each question are also shuffled
  • Use the Fisher-Yates (Knuth) shuffle algorithm for unbiased randomization
  • No question repeats within a single quiz session

Feature 2: Streak Multiplier

Acceptance Criteria:

  • Base score per correct answer: 100 points
  • Consecutive correct answers multiply the score: 1x, 1.5x, 2x, 2.5x, 3x (max)
  • An incorrect answer resets the multiplier to 1x
  • The current multiplier is prominently displayed with a visual "fire" effect at 3x
  • Bonus time points: remaining seconds × 10 added to the score

Feature 3: Social Share Card

Acceptance Criteria:

  • After the quiz, generate a shareable image/card showing: score, accuracy, time, streak
  • The card is generated using HTML-to-Canvas (or a styled div screenshot)
  • "Share on Twitter" pre-fills a tweet with the score and a link
  • The card must be downloadable as a PNG

Feature 4: Timer Pressure

Acceptance Criteria:

  • Each question has a 15-second countdown timer
  • At 5 seconds remaining, the timer turns red and a pulsing animation begins
  • At 0 seconds, the question auto-submits as incorrect
  • A "burning edge" CSS effect appears around the question card in the last 3 seconds

Feature 5: Local Leaderboard

Acceptance Criteria:

  • Top 10 scores stored in localStorage
  • Each entry: name (prompted after quiz), score, accuracy, date
  • Sorted by score descending; ties broken by accuracy
  • The user's current score highlights if it made the leaderboard
  • A "Clear Leaderboard" button with confirmation

📊 Scoring Formula

ComponentFormula
Base Points100 per correct answer
Streak Multiplier1x → 1.5x → 2x → 2.5x → 3x (caps at 3x)
Time BonusRemaining seconds × 10
Final Score(Base × Multiplier) + Time Bonus

🧪 Testing Checklist

  • Unit test shuffle algorithm produces uniform distribution
  • Unit test scoring: verify multiplier resets on wrong answer
  • Unit test leaderboard sorting and tie-breaking
  • Integration test: timer expiring auto-submits as incorrect
  • A11y: timer must be announced to screen readers

🚀 Stretch Goals

  • Add category selection (Science, History, Tech, etc.)
  • Implement "Lifelines" (50/50, Skip, Extra Time)
  • Add difficulty scaling (questions get harder as streak increases)
  • Fetch questions from an external trivia API

Practice

  • JavaScript
  • DSA
  • Machine Coding
  • System Design

Resources

  • Learning Tracks
  • Articles
  • Roadmaps
  • Compare Concepts
  • Glossary
  • Developer Tools
  • All Questions

Company

  • About
  • Pricing

Legal

  • Privacy Policy
  • Terms of Service
DevPrep

© 2026 DevPrep. All rights reserved.