$ show wesbos/JavaScript30
This repository contains the starter files and completed solutions for Wes Bos's 'JavaScript30' course - a collection of 30 vanilla JavaScript exercises, each a self-contained mini-application demonstrating a specific browser API or JavaScript pattern. The exercises cover: DOM manipulation and events (Drum Kit, Clock, Whack-a-Mole), modern array methods (Array Cardio Days 1-2), localStorage persistence, HTML5 Canvas drawing, custom video player controls, speech recognition/synthesis, webcam/media devices API, geolocation, CSS variables manipulation, flexbox transitions, sticky navigation, drag-to-scroll, type-ahead autocomplete, shift-click range selection, konami code detection, scroll-triggered animations, dropdown navigation, link highlighting, and various console/debugging techniques. Each exercise exists as a pair: START (boilerplate HTML/CSS) and FINISHED (working solution). The code is intentionally written as inline scripts in HTML files to match the video tutorials, not as modular, reusable components. There are no build tools, test suites, or dependency management (except browser-sync for live-reload in a few exercises). The repo is actively maintained to stay in sync with the course videos, but the content is pedagogically frozen - PRs that improve code but deviate from the videos are explicitly rejected.
The LLM identified 8 files worth highlighting for reuse:
A clean implementation of custom HTML5 video controls (play/pause, volume, playback rate, skip buttons, progress scrubber) built as a standalone module. Demonstrates proper event binding on video element (click, play, pause, timeupdate), range input handling for volume/rate, and progress bar scrubbing via mouse events. The logic is isolated in a separate JS file and could be extracted into a reusable video player component with minimal changes - mainly parameterizing the selector queries.
Demonstrates a complete localStorage persistence pattern: loading initial state from JSON.parse(localStorage.getItem()), updating state on user actions, and serializing back with JSON.stringify(). The addItem/populateList/toggleDone functions form a coherent mini-state-management pattern that's directly applicable to any simple client-side list app. The event delegation on the list container for checkbox toggling (using data-index attributes) is a clean touch.
Shows proper usage of the Web Speech API's SpeechRecognition interface: handling interim vs final results, auto-restarting on 'end' event for continuous listening, and filtering transcript text (profanity replacement). The pattern of creating new <p> elements for each final result while updating a single element for interim results is a practical UX pattern for live transcription apps.
Contains a well-implemented, reusable debounce utility function (configurable wait/immediate) applied to scroll-based animation triggering. The checkSlide logic calculates element visibility using scrollY, innerHeight, and element offsets - a lightweight alternative to IntersectionObserver for simple scroll animations. The debounce function itself is extractable as a general-purpose utility.
Demonstrates dynamic CSS custom property manipulation via JavaScript: reading input values (including data-sizing attributes for units) and updating :root properties with document.documentElement.style.setProperty(). This pattern enables real-time theming, user-preference persistence, and design token systems without CSS-in-JS libraries.
Implements the classic 'shift-click to select range' pattern (like Gmail's checkbox selection). Tracks lastChecked element, uses a boolean flag (inBetween) toggled when encountering either boundary element, and checks all checkboxes in between. Clean, framework-free implementation of a common UX pattern that's directly reusable in any tabular data interface.
Shows a canvas drawing loop with hue-cycling stroke colors and dynamic line width oscillation. Demonstrates proper mousedown/mousemove/mouseup/mouseout event handling for drawing, ctx.getImageData/putImageData for pixel manipulation (though commented out), and HSL color space animation. The core drawing loop pattern is extractable for any freehand drawing or signature capture feature.
Implements click-and-drag horizontal scrolling (like a trackpad swipe) on a flex container. Tracks mousedown position, calculates drag distance on mousemove, and applies to scrollLeft with a multiplier. Handles mouseleave/mouseup cleanup. A reusable pattern for any horizontally overflowing carousel or timeline component that needs mouse-based navigation.