Projects

Hangman Game

Browser-based Hangman game with a virtual keyboard, 10 attempts, progressive gallows images, and a dark mode toggle.

  • JavaScript
  • Vite
  • Tailwind CSS

A browser-based Hangman game written in vanilla JavaScript with no UI frameworks. The player guesses a word letter by letter via an on-screen keyboard; each mistake decrements the attempt counter and updates the gallows image — 10 stages in total plus a separate win frame.

Technical decisions

Built with Vite, styled with Tailwind CSS. The secret word is stored in sessionStorage to prevent discovery via global variables. Theme preference is persisted in localStorage and applied by toggling the dark class on <html>. All gallows images are preloaded via <link rel='preload'> so stage transitions never flicker.

Game logic lives in game.js, utilities in utils.js, and constants in consts.js. Adding new words requires only appending to the WORDS array.