Designing and coding websites so all users — including those with visual, motor, cognitive, or hearing disabilities — can perceive, navigate, and interact with content.
200+ notes covering every core concept of full-stack web development — from beginner HTML & CSS to React, Node.js, SQL, security, performance, accessibility, UI patterns, and the W3.CSS framework. Sourced from W3Schools, MDN, CSS-Tricks, javascript.info, and more.
Designing and coding websites so all users — including those with visual, motor, cognitive, or hearing disabilities — can perceive, navigate, and interact with content.
Technique for sending and receiving data from a server asynchronously without reloading the page. Now typically done with Fetch API or Axios instead of XMLHttpRequest.
The <a> element creates hyperlinks to other pages, files, email addresses, or locations on the same page. Key attributes: href, target, rel, download.
CSS @keyframes rules and the animation shorthand let you animate elements between style states. Key properties: animation-name, duration, timing-function, delay, iteration-count, direction.
A set of rules allowing different software to communicate. REST APIs use HTTP methods (GET, POST, PUT, DELETE) with JSON responses. Browser Web APIs include DOM, Fetch, Canvas, Web Storage, etc.
HTML attributes (role, aria-label, aria-hidden, aria-expanded…) that add semantic meaning to elements for screen readers when plain HTML alone is not descriptive enough.
Ordered lists of values. Key methods: push, pop, shift, unshift, splice, slice, map, filter, reduce, find, findIndex, flat, flatMap, includes, sort, forEach.
Syntactic sugar over Promises that makes asynchronous code look synchronous. async functions always return a Promise; await pauses execution until the Promise resolves.
Authentication verifies WHO you are (login, JWT, OAuth). Authorisation determines WHAT you can access (roles, permissions). Both are critical for secure web apps.
Apache (uses .htaccess, module-based) and Nginx (event-driven, reverse proxy, static files) are the two dominant web servers. Nginx is commonly used as a reverse proxy in front of Node.js or PHP apps.
Concise function syntax: const fn = (params) => expression. No own this, arguments, super, or new.target. Implicit return for single expressions (no braces needed). Cannot be used as constructors.
Expand/collapse content sections on click. Toggle a CSS class to show/hide panels. Use max-height transition for smooth animation. Only one panel open at a time (exclusive) or allow multiple open simultaneously.
Styled feedback buttons: success (green), info (blue), warning (yellow), danger (red). Pair with dismissible alert bars. Use role="alert" and aria-live="polite" for screen reader announcements.
Three-line hamburger icon that animates to an X on toggle using CSS transforms and transitions. No images required — built with three <span> elements and rotate/translate transforms.
Background shorthand controls background-color, background-image, background-repeat, background-position, background-size (cover/contain), and background-attachment.
Block elements (div, p, h1–h6, section) start on a new line and take full width. Inline elements (span, a, strong, img) flow within text. display CSS overrides this.
Popular CSS framework with a 12-column responsive grid, pre-built components (navbar, cards, modals, buttons), and utility classes. Version 5 drops jQuery dependency.
Every HTML element is a rectangular box with: content → padding → border → margin. box-sizing: border-box includes padding+border in the declared width.
Built-in browser tools (F12) for inspecting HTML/CSS, debugging JavaScript, monitoring network requests, profiling performance, and auditing accessibility. Available in Chrome, Firefox, Edge, Safari.
localStorage persists data with no expiry. sessionStorage lasts per tab session. Cookies are sent with every HTTP request and can set expiry dates. IndexedDB is for larger structured data.
CSS naming methodology: Block (.card), Element (.card__title), Modifier (.card--featured). Prevents class name collisions, improves readability, and makes component styles self-documenting without deep nesting.
Bundlers (webpack, Rollup, esbuild) combine JS modules into fewer files for production. Tree shaking statically analyses import/export graphs to remove dead (unused) code — often halves bundle size.
A function passed as an argument to another function, to be executed when an event or operation completes. The foundation of asynchronous JavaScript before Promises.
The <canvas> element provides a 2D drawing surface via JavaScript. Used for games, charts, image manipulation, and generative art. Methods: fillRect, arc, drawImage, getImageData.
Syntactic sugar over prototypal inheritance. Supports constructor, methods, static methods, getters/setters, inheritance (extends), and private fields (#field).
A function that retains access to its outer scope even after the outer function has returned. Key to data encapsulation, memoisation, and module patterns.
CSS colors can be specified as keywords, hex (#ff6600), rgb(), rgba(), hsl(), hsla(), oklch(). oklch is the modern standard with perceptual uniformity.
HTTP response header that controls which resources (scripts, styles, images) the browser can load. A strong CSP is the primary defence against XSS attacks.
Browser security mechanism that blocks requests to a different origin (domain, protocol, port) unless the server explicitly permits it via Access-Control-Allow-Origin headers.
Two-dimensional layout system. Define columns and rows with grid-template-columns/rows. Place items with grid-column, grid-row. Use fr units, minmax(), auto-fit, and auto-fill.
Define reusable values with --variable-name: value inside :root {}. Reference with var(--variable-name). Cascade and inherit like normal CSS. Readable by JavaScript.
Target HTML elements by type (p), class (.class), ID (#id), attribute ([type="text"]), pseudo-class (:hover, :nth-child), pseudo-element (::before). Specificity determines precedence.
Determines which CSS rule wins when multiple rules target the same element. Order (low→high): *, tag, class/attribute/pseudo-class, ID, inline style, !important.
HTTP caching: Cache-Control (max-age, no-cache, no-store, stale-while-revalidate), ETag, Last-Modified. Service Worker cache for offline-first. CDN edge caching. Browser heuristic caching.
Continuous Integration runs automated tests on every push. Continuous Deployment ships passing builds automatically. Tools: GitHub Actions, GitLab CI, Jenkins, CircleCI. Typical stages: lint → test → build → deploy.
HttpOnly prevents JS access to cookies (blocks XSS theft). Secure ensures cookies only sent over HTTPS. SameSite=Strict/Lax prevents CSRF. Use all three flags together for session cookies.
The "C" in CSS. Rules cascade: user-agent → author → user styles. Inheritance allows child elements to inherit properties (color, font-*) from parents. The all property resets all inherited and specified values.
Style elements based on their container's size, not the viewport. Set container-type: inline-size on the parent, then @container (min-width: 400px) {}. The future of truly portable, component-based responsive design.
2D: translate(x,y), rotate(deg), scale(x,y), skew(deg). 3D: translate3d, rotateX/Y/Z, perspective. Composited on the GPU — animate transform instead of top/left for smooth 60fps with zero layout thrashing.
Tricks a logged-in user into making an unintended request to a trusted site. Prevention: CSRF tokens in forms, SameSite cookie attribute, checking Origin/Referer headers, and the double-submit cookie pattern.
clip-path cuts an element to a shape: circle(), ellipse(), inset(), polygon(), or an SVG path. mask-image uses an image or gradient as an alpha mask. Great for creative image reveals and shape effects.
Display time remaining until a date. Calculate difference between target and Date.now(). Break into days, hours, minutes, seconds. Use setInterval(fn, 1000) to update every second. Clear interval on reaching zero.
Style native inputs with CSS: toggle switches (appearance: none + transform), custom checkboxes/radios, styled <select> with a custom arrow. Range sliders styled with ::-webkit-slider-thumb and accent-color.
Style forms with clean card layouts: floating labels, full-width inputs, focus highlight borders, submit button hover effects. Always pair with server-side validation, honeypot fields, and rate limiting to prevent spam.
Primitives: string, number, bigint, boolean, undefined, null, symbol. Reference types: object, array, function. Use typeof to inspect. Primitives are passed by value, objects by reference.
Relational DBs (MySQL, PostgreSQL) use tables + SQL with ACID transactions. NoSQL (MongoDB, Redis, Firebase) use documents, key-value, or graph structures for flexibility and scale.
Serving your web app to users. Options: Shared hosting (cPanel), VPS (DigitalOcean, Linode), Serverless (Vercel, Netlify, Cloudflare Pages), containers (Docker + Kubernetes).
Extract values from arrays or properties from objects into named variables. Supports default values, renaming, and nested patterns. Works in function parameters too.
Translates human-readable domain names (example.com) into IP addresses. A records, CNAME, MX, TXT records. TTL controls caching. CDNs use Anycast DNS for routing.
The browser's tree representation of HTML. Access with querySelector, querySelectorAll, getElementById. Modify with innerHTML, textContent, style, classList, setAttribute, appendChild, remove.
Detect OS-level dark mode with @media (prefers-color-scheme: dark). Combined with CSS custom properties to swap themes without class changes. Store user override in localStorage and apply via JS.
Package apps with all dependencies into containers. Dockerfile defines the image. docker build, run, push, pull. docker-compose.yml orchestrates multi-container setups (web + db + redis). Ensures dev-prod parity.
Custom attributes starting with data- store extra info on HTML elements without invalid attributes. Access in JS with element.dataset.myKey. Useful for storing config, state, or IDs on DOM elements.
Hover dropdown: position: relative on parent, absolute on menu, toggle display on :hover. Click dropdown: toggle a "show" class with JS. Navbar dropdowns: use the same pattern inside a flexbox nav. Close on outside click.
Use try/catch/finally to handle runtime errors. throw creates custom errors. async functions propagate errors through rejected Promises. Always handle Promise rejections.
Key ES6+ features: let/const, arrow functions, template literals, destructuring, spread/rest, default params, modules (import/export), optional chaining (?.), nullish coalescing (??), Promise, class.
Add event listeners with addEventListener('click', handler). Events bubble up the DOM by default. Use event.preventDefault() to block defaults, stopPropagation() to stop bubbling. Event delegation improves performance.
Minimal Node.js web framework for building REST APIs and server-side apps. Core concepts: routes (GET/POST/PUT/DELETE), middleware, request/response objects, static files, error handling middleware.
Store config and secrets outside source code in .env files. Access in Node.js via process.env.NAME. Use the dotenv package. Never commit .env to Git — add it to .gitignore. Vite exposes VITE_-prefixed vars to the browser.
ESLint statically analyses JS/TS for bugs and style issues. Prettier auto-formats code on save. Use together: Prettier owns formatting, ESLint owns code quality. Combine with pre-commit hooks (Husky + lint-staged).
Modern replacement for XMLHttpRequest. fetch(url) returns a Promise. Chain .then(res => res.json()) to parse JSON. Use async/await for cleaner syntax. Handles GET, POST, headers, CORS.
One-dimensional layout model. Set display: flex on a container. Key properties: flex-direction, justify-content (main axis), align-items (cross axis), flex-wrap, gap, flex-grow/shrink/basis.
HTML forms collect user input. Elements: input (text, email, password, checkbox, radio, file, date, range), textarea, select, button. Attributes: action, method, name, required, pattern, autocomplete.
Reusable blocks of code. Declaration (hoisted), expression (not hoisted), arrow functions (=>, no own this). IIFE for immediate execution. Rest params (...args), default params. First-class citizens.
Favicon sets the browser tab icon: provide 16×16, 32×32, and 180×180 Apple sizes. manifest.json makes PWAs installable: name, short_name, icons, theme_color, background_color, display, start_url.
@font-face loads custom fonts. font-display: swap avoids invisible text while loading. Use Google Fonts or self-host for privacy and speed. Subset fonts to needed characters only. Always prefer WOFF2 format for smallest file size.
Filter DOM elements in real time by matching input text against element textContent. For tables: loop <tr> and toggle display. For card grids: match category data-* attributes. Combine search + category buttons for powerful UX.
position: fixed removes element from flow, always visible. position: sticky keeps element in flow until it reaches a scroll threshold — best for headers. Combine with box-shadow and background change on scroll for polished UX.
A nav menu that expands to cover the full screen. Set width/height to 0 → 100% with overflow: hidden and transition. Position: fixed, z-index high. Add slide-in/down animation variants. Close with Esc key for accessibility.
Distributed VCS. Key commands: git init, clone, add, commit, push, pull, branch, checkout, merge, rebase, stash, log, diff. Branching strategies: Git Flow, trunk-based development.
Remote repository hosting, PR-based code review, CI/CD pipelines (GitHub Actions, GitLab CI), issue tracking, and project management. Essential for team collaboration.
Generator functions (function*) use yield to pause and resume execution. Iterables implement Symbol.iterator. Used in async control flow, infinite sequences, and data streaming.
Query language for APIs — clients request exactly the data they need, eliminating over/under-fetching. Single /graphql endpoint. Schema defines types; resolvers fetch data. Tools: Apollo Server, Hasura, GraphQL Yoga.
Every page begins with !DOCTYPE html. The <html> element wraps <head> (meta, title, links) and <body> (visible content). lang attribute is required for accessibility.
Semantic tags communicate meaning to browsers and screen readers: header, nav, main, article, section, aside, footer, figure, figcaption, time, mark, details, summary.
GET (retrieve), POST (create), PUT/PATCH (update), DELETE (delete). Status codes: 200 OK, 201 Created, 400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not Found, 500 Server Error.
Security-critical headers: Content-Security-Policy, X-Frame-Options, Strict-Transport-Security (HSTS), X-Content-Type-Options, Referrer-Policy. Performance: Cache-Control, ETag.
Variable and function declarations are moved to the top of their scope before execution. var is hoisted and initialised as undefined. let/const are hoisted but not initialised (Temporal Dead Zone). Function declarations are fully hoisted.
HTTPS encrypts data in transit using TLS. Free certificates via Let's Encrypt. HTTP/2 and HTTP/3 (QUIC) require HTTPS. Enable HSTS to force HTTPS. Mixed content (HTTP assets on HTTPS page) breaks the security model.
<head> is for metadata. Critical elements: <title>, charset, viewport, <link rel="stylesheet">, <link rel="preload">, <link rel="canonical">, <script defer>. Loading order impacts performance.
<img src alt width height loading="lazy">. Use WebP/AVIF for small file sizes. srcset and sizes for responsive images. <picture> for art direction. <video> and <audio> for embedded media.
Browser-side transactional database for large structured data. Supports indexes, transactions, and object stores. Async API. Better than localStorage for complex offline apps.
Efficiently detects when elements enter/leave the viewport. Used for lazy loading images, infinite scroll, scroll-triggered animations, and analytics tracking — without scroll event listeners.
A function that runs immediately after being defined: (function(){ ... })(). Creates a private scope to avoid polluting the global namespace. Classic pattern before ES Modules. Arrow version: (() => { ... })().
Never trust user input. Validate on both client AND server — client-side is UX only. Server-side: check type, length, format. Sanitise HTML to prevent XSS. Use parameterised queries for SQL. Libraries: Zod, Yup, Joi.
Cycle through images with previous/next buttons. Store images in an array, track current index, use opacity or translateX transitions. Add dot indicators. Optional auto-play with setInterval. Pause on hover.
Image overlay on hover: wrap in a container (position: relative), add an absolutely-positioned overlay div, transition opacity 0 → 1 on :hover. Effects: fade, slide up/down, zoom (transform: scale on img), grayscale filter.
ES Modules use import/export syntax. Use type="module" on <script>. Named exports, default exports. Code splitting enables lazy loading of modules. CommonJS (require/module.exports) is Node's legacy module system.
Lightweight data-interchange format. Keys must be strings in double quotes. Values: string, number, boolean, null, array, object. JSON.stringify() to encode, JSON.parse() to decode.
DOM manipulation library that simplifies selecting elements, handling events, AJAX, and animations. Syntax: $('selector').method(). Still widely used in legacy codebases.
Compact, self-contained token for transmitting claims between parties. Three parts: header.payload.signature (Base64URL encoded). Used for stateless authentication. Store securely — not localStorage.
JS is single-threaded. The event loop picks tasks from the callback queue when the call stack is empty. Microtasks (Promises, queueMicrotask) run before macrotasks (setTimeout, setInterval). Blocking the stack freezes the UI.
position: static (default), relative (offset from normal), absolute (removed from flow, relative to nearest positioned ancestor), fixed (relative to viewport), sticky (hybrid).
Defers loading of non-critical resources (images, scripts, routes) until needed. Native: <img loading="lazy">. JS: Intersection Observer. Route-level: dynamic import() in React/webpack.
Web Storage API provides localStorage (persists until cleared) and sessionStorage (per-tab). Both store strings: use JSON.stringify/parse for objects. 5MB limit. Synchronous — avoid large reads on main thread.
Linters analyse code without running it. ESLint for JS/TS, Stylelint for CSS, HTMLHint for HTML. Run in CI to catch bugs before merge. Combine with Prettier for auto-formatting and pre-commit hooks for enforcement.
Click a thumbnail to show a full-size image in a modal overlay. Built with a fixed overlay div, an <img> src swap, and background-click-to-close. Support keyboard navigation (← →) and Esc to close.
Pure CSS loading indicators: spinning ring (border-radius: 50% + border + animation: spin), dots, progress skeleton. Show while async data loads. Always include aria-label="Loading" and role="status" for accessibility.
Card-style login form with email + password inputs, show/hide password toggle button, "Forgot password?" link, and submit button. Use autocomplete="current-password" and input type="password". Always submit over HTTPS.
@media rules apply styles based on viewport size, orientation, color scheme (prefers-color-scheme), and more. Always use mobile-first: start with small styles, add breakpoints upward.
Essential meta tags: charset, viewport, description, og:title/description/image (Open Graph), twitter:card. Use canonical to avoid duplicate content. Structured data (JSON-LD) enhances search results.
SQL fundamentals: SELECT, INSERT, UPDATE, DELETE, WHERE, ORDER BY, GROUP BY, HAVING, JOIN (INNER, LEFT, RIGHT), UNION, subqueries, indexes, transactions (BEGIN, COMMIT, ROLLBACK).
Document-oriented NoSQL database. Stores data as BSON (binary JSON). Key operations: find, insertOne, updateOne, deleteOne, aggregate. Mongoose adds schema validation for Node.js.
Map is a key-value store where keys can be any type (unlike plain objects). Set stores unique values only. WeakMap and WeakSet hold weak references (garbage-collector-friendly). Both are iterable with for...of.
Adjacent vertical margins of block elements collapse into a single margin (the larger one). Does NOT happen inside flex/grid containers, or with floated/absolute elements. A very common source of layout confusion.
Higher-order functions take or return functions: map, filter, reduce, compose, curry. Mixins copy methods from one object to another (Object.assign). Functional patterns like these enable code reuse without deep inheritance.
Overlay dialog that blocks the rest of the page. Fixed full-screen backdrop (rgba overlay), centred card. Toggle display/visibility with JS. Trap focus inside (Tab loop). Close on Esc, backdrop click, and × button. Use the native <dialog> element in modern code.
JavaScript runtime built on Chrome's V8 engine. Event-driven, non-blocking I/O. Core modules: fs, http, path, crypto, stream, events. Use npm/yarn/pnpm for package management.
npm is the default Node.js package manager. package.json tracks dependencies. Key commands: npm install, npm run, npm update, npm audit (security). Alternatives: yarn, pnpm (faster, disk-efficient).
React meta-framework with file-system routing, Server-Side Rendering (SSR), Static Site Generation (SSG), Incremental Static Regeneration (ISR), React Server Components, API Routes, and built-in image/font optimisation.
undefined: declared but not assigned. null: intentional empty value. NaN: invalid arithmetic result. null == undefined is true; null === undefined is false. typeof null === "object" is a language bug — use === null to check.
Key nav types: Top nav (flexbox, fixed/sticky), Side nav (fixed left panel, slide-in), Bottom nav (mobile), Responsive nav (hamburger → mobile menu). Always use <nav> with aria-label. Highlight active links.
OAuth 2.0 is an authorisation framework that grants apps limited access to user accounts. OpenID Connect (OIDC) adds authentication on top. Used by Google, GitHub, Facebook login.
Collections of key-value pairs. Shorthand properties, computed keys, method shorthand. Spreading ({...obj}), Object.keys/values/entries, Object.assign, Object.freeze. Prototype chain for inheritance.
Update the UI immediately before receiving server confirmation, then roll back on error. Common in React Query, SWR, and modern frameworks. Improves perceived performance.
obj?.prop safely returns undefined if obj is null/undefined instead of throwing. a ?? b returns b only if a is null/undefined (unlike || which also triggers on 0, "", false). Combine as obj?.prop ?? defaultValue.
Semi-transparent layer over page content. Built with position: fixed, width/height 100%, background: rgba(0,0,0,0.5). Used for modals, sidebars, galleries, cookie consent banners. Backdrop-filter: blur() adds a frosted-glass effect.
Google's key user-centric metrics: LCP (Largest Contentful Paint < 2.5s), CLS (Cumulative Layout Shift < 0.1), INP (Interaction to Next Paint < 200ms). Measured by Lighthouse, PageSpeed Insights.
Server-side scripting language embedded in HTML. Runs on Apache/Nginx. Key features: superglobals ($_GET, $_POST, $_SESSION, $_COOKIE), PDO for DB access, Composer for packages, Laravel framework.
Web apps with native-like capabilities: offline support (Service Worker + Cache API), installable (Web App Manifest), push notifications, background sync. Must be served over HTTPS.
Represents eventual completion or failure. States: pending, fulfilled, rejected. Chain with .then()/.catch()/.finally(). Combine with Promise.all(), Promise.allSettled(), Promise.race(), Promise.any().
JavaScript objects inherit from other objects via the prototype chain. Every object has [[Prototype]] (accessible via __proto__ or Object.getPrototypeOf). Functions have a .prototype property used when creating instances with new.
Pseudo-classes select based on state: :hover, :focus, :active, :nth-child(), :not(), :is(), :where(), :has(). Pseudo-elements style parts of elements: ::before, ::after, ::placeholder, ::selection, ::first-line.
Display large datasets in pages. SQL: LIMIT 20 OFFSET 40. API: return { page, totalPages, totalCount, data }. Cursor-based pagination scales better than offset at large volumes. UI: numbered pages vs infinite scroll vs "Load more".
SASS/SCSS adds variables, nesting, mixins, partials, @extend, and @use to CSS. SCSS is a superset of CSS syntax. PostCSS (autoprefixer, cssnano) transforms CSS via plugins. Vite and webpack handle SCSS natively.
Background moves slower than foreground on scroll creating depth. CSS only: background-attachment: fixed on a section. JS version: read scrollY and set background-position-y for precise control. Disable on mobile (performance).
Grid of work samples filterable by category. Assign data-category to each card. Filter buttons show/hide cards using JS classList or CSS. Animate with transitions on opacity and transform. Use CSS Grid or Masonry layout.
Animated width bar showing task progress. HTML: container div + inner div. CSS: width transition. JS: set style.width = percentage + "%". Use <progress value="70" max="100"> for native semantic progress bars with built-in ARIA.
Small overlay triggered by a button. Toggle visibility with JS. Position relative to trigger element. Close on outside click (document mousedown listener). Modern alternative: use the HTML Popover API (popover attribute, popovertarget) — zero JS needed.
document.querySelector("css-selector") returns the first matching element; querySelectorAll() returns a static NodeList. getElementById, getElementsByClassName, and getElementsByTagName are older alternatives.
Data after ? in URLs: ?name=Alice&age=30. Parse in JS with new URLSearchParams(window.location.search). Access in Node/Express with req.query. In PHP: $_GET["name"]. Always encode values with encodeURIComponent.
UI library for building component-based UIs. Core concepts: JSX, functional components, props, state (useState), side effects (useEffect), conditional rendering, lists & keys, event handling.
Functions that let functional components use state and lifecycle features. Built-in: useState, useEffect, useContext, useRef, useMemo, useCallback, useReducer, useId. Custom hooks extract reusable logic.
Client-side routing for React SPAs. v6: Routes/Route, useNavigate, useParams, useLocation, Outlet, nested routes, lazy routes, loader/action for data fetching (React Router v7).
Pattern matching for strings. Syntax: /pattern/flags. Flags: g (global), i (insensitive), m (multiline). Methods: test(), match(), matchAll(), replace(), replaceAll(), split(). Character classes, quantifiers, groups, lookaheads.
Representational State Transfer: stateless, resource-based URLs (/users/{id}), proper HTTP verbs, consistent JSON responses, versioning (/api/v1/), pagination, error codes, and OpenAPI documentation.
Sites that adapt to any screen size. Pillars: fluid grids (%, fr, vw), flexible images (max-width: 100%), media queries. Use viewport meta tag. Mobile-first approach.
Share state across the component tree without prop drilling. createContext() creates the context, Provider wraps the tree with a value, useContext(Ctx) consumes it. Ideal for auth, theme, locale — not high-frequency state updates.
Redux: predictable unidirectional data flow — actions → reducers → store → UI. Redux Toolkit removes boilerplate. Zustand: lightweight hooks-based store. React Query/SWR handle server state (caching, refetching, mutations).
Custom styled <input type="range">. Read value with oninput event. Show live value in a label. Style the track (::-webkit-slider-runnable-track) and thumb (::-webkit-slider-thumb, accent-color). Good for volume, price filters, opacity controls.
Scope determines where variables are accessible. Global scope, function scope, block scope (let/const). Lexical scoping means inner functions access outer variables. Module scope is isolated from global.
Top web vulnerabilities: A01 Broken Access Control, A02 Cryptographic Failures, A03 Injection (SQL/XSS), A04 Insecure Design, A05 Security Misconfiguration. Every web developer must know these.
Background scripts that intercept network requests, cache responses, and enable offline functionality. Required for PWAs. Lifecycle: install, activate, fetch. Used with workbox for easier setup.
INNER JOIN returns matching rows in both tables. LEFT JOIN returns all rows from left + matching from right. RIGHT JOIN is the reverse. FULL OUTER JOIN returns all rows from both. CROSS JOIN returns cartesian product.
Spread (...) expands an iterable into elements (arrays, function args, object cloning). Rest (...) collects remaining arguments into an array. Both use the same syntax in different positions.
XML-based format for resolution-independent vector images. Inline SVG can be styled with CSS and scripted with JavaScript. Key elements: path, circle, rect, line, polygon, text, defs, use.
Indexes let the DB locate rows without a full table scan. PRIMARY KEY and UNIQUE create indexes automatically. Use EXPLAIN/EXPLAIN ANALYZE to inspect query plans. Avoid N+1 queries and SELECT * in production.
ACID: Atomicity (all or nothing), Consistency (valid state after commit), Isolation (concurrent transactions don't interfere), Durability (committed data survives crashes). Use BEGIN / COMMIT / ROLLBACK to group SQL statements.
window.scrollTo({ top: 0, behavior: "smooth" }). element.scrollIntoView({ behavior: "smooth" }). scroll-behavior: smooth in CSS. Track scroll position with window.scrollY. Use passive event listeners for performance.
Shadow DOM attaches a scoped DOM tree to an element. Styles inside the shadow root do not leak out, and external styles do not leak in. Foundation of Web Components. Access with element.attachShadow({ mode: "open" }).
Expandable search: icon button expands to an input with a CSS width transition. Inline search bar: input with search icon positioned absolutely inside. Always use type="search" for built-in clear button and semantic meaning.
Off-canvas panel that slides in from the left/right. Start at width: 0 or translateX(-100%), animate to full width on open. Overlay the rest of the page with a semi-transparent backdrop. Trap focus, close on Esc.
Styled share buttons using brand colours (Facebook #3b5998, X/Twitter #1da1f2, LinkedIn #0077b5, YouTube #ff0000). Use SVG icons or icon fonts. Add title attributes for accessibility. Always open in new tab with rel="noopener".
Sort an array of DOM elements by textContent using Array.from + .sort() + re-append. For tables: collect <td> values into an array, sort, rebuild rows. Toggle ascending/descending by flipping the comparator direction.
Add/remove a class when window.scrollY passes a threshold (IntersectionObserver or scroll event). Change nav background, add shadow, shrink logo — creates a polished fixed header effect. Use position: sticky where possible to avoid JS.
Use <table>, <thead>, <tbody>, <tfoot>, <tr>, <th scope="col/row">, <td>. caption for title. colspan/rowspan to merge cells. Tables are for data, not layout.
Backtick strings that support multiline text and embedded expressions: `Hello ${name}!`. Tagged templates allow custom string processing. Avoid concatenation — use template literals instead.
"this" refers to the calling context. In regular functions it depends on how called. Arrow functions inherit "this" from enclosing scope. .call(), .apply(), .bind() explicitly set this.
Smoothly animate CSS property changes. Syntax: transition: property duration timing-function delay. Use ease, ease-in-out, cubic-bezier(). Only animate transform and opacity for 60fps performance.
Superset of JavaScript with static typing. Types catch bugs at compile time. Key features: interfaces, type aliases, generics, enums, union/intersection types, type narrowing, decorators. Compiles to plain JS.
Unit: test one function in isolation (Jest, Vitest). Integration: test multiple units working together. E2E: simulate real browser interaction (Playwright, Cypress). Test pyramid: many unit → fewer integration → fewest E2E tests.
Key properties: font-family, font-size, font-weight (100–900), line-height (1.5 for body), letter-spacing, text-align, text-transform, text-overflow: ellipsis, white-space, word-break. Use clamp() for fluid type scaling.
Union types (A | B), intersection types (A & B), generics (T extends K), conditional types (T extends U ? X : Y), mapped types, utility types (Partial, Required, Readonly, Pick, Omit, Record, ReturnType, Parameters).
Tab buttons switch between content panels. Hide all panels, show the target one. Set active class on clicked tab. Use role="tablist", role="tab", role="tabpanel", aria-selected, and aria-controls for full accessibility. Support arrow-key navigation.
Toggle visibility of an element on button click. Methods: element.style.display, classList.toggle("hidden"), or animate max-height 0 → auto for smooth expand. Update aria-expanded and button text ("Show" ↔ "Hide") for accessibility.
Small info popup on hover. CSS-only: position: relative on parent, ::before/::after pseudo-elements for the box and arrow, show on :hover. Positions: top, bottom, left, right. For complex tooltips use Floating UI or Tippy.js.
Absolute: px, cm, in. Relative: em (parent font-size), rem (root font-size), % (parent), vw/vh (viewport), vmin/vmax, svh/dvh (dynamic viewport on mobile), ch (character width), clamp().
Anatomy: scheme://host:port/path?query#fragment. URL encoding converts special characters: space = %20. Use encodeURIComponent() in JS. URLSearchParams for building query strings.
describe() groups tests; it()/test() defines each; expect() with matchers: toBe (===), toEqual (deep), toThrow, toHaveBeenCalled, toMatchSnapshot. Mock with jest.fn()/vi.fn(). Vitest is Jest-compatible and Vite-native.
Card components wrap content (image, title, text, CTA) in a rounded container. CSS Grid or Flexbox for the grid. Hover: translateY(-4px) + box-shadow for lift effect. Use aspect-ratio for consistent image heights.
var: function-scoped, hoisted, avoid in modern code. let: block-scoped, reassignable. const: block-scoped, must be initialised, cannot be reassigned (but object contents can mutate).
Modern build tools: Vite (lightning-fast HMR, ESM dev server, Rollup for prod), webpack (powerful, configurable, slower), Parcel (zero-config). Bundling, tree-shaking, code splitting, minification.
<meta name="viewport" content="width=device-width, initial-scale=1"> prevents mobile browsers zooming out. Without it, responsive CSS won't work on mobile. Never use user-scalable=no — it harms accessibility.
React's in-memory representation of the real DOM. On state change, React diffs the new vs old virtual DOM (reconciliation) and applies only the minimal real DOM changes. The key prop helps the diffing algorithm identify list items.
Native browser standard for reusable encapsulated components. Three technologies: Custom Elements, Shadow DOM (style encapsulation), HTML Templates (<template>, <slot>). No framework required.
Techniques: minify CSS/JS, compress images (WebP/AVIF), use CDN, enable HTTP/2, gzip/Brotli compression, lazy loading, font display swap, preload critical resources, reduce render-blocking scripts.
Full-duplex, persistent connection between client and server. Used for real-time apps (chat, live scores, collaborative editing, trading). The WebSocket API is built into browsers. Server libraries: ws, Socket.io.
International standard for web accessibility. POUR principles: Perceivable, Operable, Understandable, Robust. Levels: A (minimum), AA (legal standard in many countries), AAA (enhanced).
Binary instruction format that runs in browsers at near-native speed. Compiled from C, C++, Rust, Go. Use for compute-heavy tasks: image processing, video codecs, games, crypto. Interops with JavaScript via a JS API.
Builds a dependency graph from an entry point and outputs optimised bundles. Key config: entry, output, loaders (Babel, CSS, images), plugins (HtmlWebpackPlugin, MiniCssExtractPlugin), mode (development/production), devServer.
Test a11y with: Lighthouse (Chrome DevTools), WAVE extension, axe DevTools, VoiceOver (macOS/iOS), NVDA/JAWS (Windows), keyboard-only navigation, and colour contrast checkers. Aim for 4.5:1 contrast ratio for normal text (WCAG AA).
W3.CSS is a free, lightweight CSS-only framework by W3Schools — no JavaScript or jQuery required. Include via CDN: <link rel="stylesheet" href="https://www.w3schools.com/w3css/5/w3.css">. Smaller and simpler than Bootstrap, ideal for quick responsive pages.
Provides background (w3-red, w3-teal, w3-blue, w3-amber…), text (w3-text-red), border (w3-border-blue), and hover (w3-hover-red) color classes. Inspired by Material Design colors. V5 added cobalt, emerald, crimson and semantic classes: w3-danger, w3-warning, w3-success, w3-info.
w3-container adds 16px left/right padding to any element (div, section, header, footer, article). w3-panel adds 16px padding plus top/bottom margin. Combine with color classes: class="w3-container w3-teal". Works equally on <div> and semantic HTML5 elements.
w3-grid creates a CSS Grid container (2D: rows AND columns). Children auto-become grid items. Use grid-template-columns, gap, grid-area inline styles. w3-grid-padding adds gutter spacing. Supports repeat(), fr units, auto-fit, and named template-areas — all standard CSS Grid properties.
w3-flex creates a Flexbox container (1D: rows OR columns). Use w3-flex-wrap for wrapping children. w3-bar is a ready-made flex nav bar; w3-bar-item removes gaps between children. Alignment helpers (w3-center, w3-left, w3-right) work inside flex containers.
Two classes: w3-btn (shadow hover) and w3-button (grey hover, inherits parent color). Modifiers: w3-block (full-width), w3-circle, w3-ripple (click wave), w3-round-xlarge (pill). Sizes: w3-tiny to w3-jumbo. Combine with w3-bar and w3-bar-item to build nav bars.
w3-card (= w3-card-2) adds a 2px box shadow; w3-card-4 adds a 4px shadow for more depth. Add color classes, w3-container sections and images inside. w3-hover-shadow makes any element look like a w3-card-4 on mouse-over — great for hover lift effects on grids.
w3-table is the base class. Combine: w3-striped (zebra rows), w3-bordered (border on each row), w3-border (outer border), w3-hoverable (row highlight), w3-centered, w3-table-all (everything). Wrap in w3-responsive for horizontal scroll on small screens. Apply w3-color classes to rows or headers.
w3-bar is a horizontal nav bar; add w3-bar-item to children for flush layout with no gaps. Pin with w3-top or w3-bottom. Use w3-sidebar for a vertical side panel. Float items with w3-left / w3-right. Combine with w3-color and w3-hover-color for themed navs.
Entrance classes: w3-animate-top, w3-animate-bottom, w3-animate-left, w3-animate-right, w3-animate-opacity (fade), w3-animate-zoom. Continuous: w3-spin (360° loop), w3-pulse (scale beat). Image filters: w3-grayscale, w3-grayscale-max, w3-hover-grayscale. All pure CSS — no JS needed.
w3-modal creates a full-screen overlay (hidden by default). w3-modal-content is the centred dialog box. Show/hide with JS: element.style.display = "block". Pair with w3-animate-zoom or w3-animate-top for entrance effect. Use w3-card-4 inside for depth and w3-button to close.
w3-badge makes a circular indicator for notification counts or status dots. w3-tag makes a rectangular chip/label. Both accept any w3-color class. Float badges next to nav list items with w3-right for the classic sidebar notification pattern.
Visibility: w3-hide-small (≤601px), w3-hide-medium (601–993px), w3-hide-large (≥993px). Column helpers: w3-half, w3-third, w3-quarter, w3-rest inside w3-row. w3-responsive wraps wide content for horizontal scroll. Use w3-content to limit max-width of page sections.
w3-image makes images responsive (max-width:100%). w3-circle clips any element into a circle — great for avatars. Border-radius modifiers: w3-round, w3-round-large, w3-round-xlarge. w3-grayscale / w3-hover-grayscale desaturate photos. Use w3-display-container + w3-display-* to overlay text on images.
Attacker injects malicious scripts into trusted websites. Types: Reflected, Stored, DOM-based. Prevention: escape output, use textContent not innerHTML, implement CSP, use HttpOnly cookies.
The original async HTTP API (pre-Fetch). Create with new XMLHttpRequest(), then open(method, url), send(). Events: onload, onerror, onprogress. Still found in legacy codebases and Axios internals. Prefer the Fetch API for new code.
Human-friendly data serialisation format used in config files (Docker Compose, CI/CD pipelines, GitHub Actions, Kubernetes). Indentation-sensitive. Values: strings, numbers, arrays, objects, booleans, null.
Yarn: parallel installs, workspaces, Plug'n'Play (zero-installs). pnpm: content-addressable store saves disk space, strict by default — avoids phantom dependencies. Both are drop-in npm alternatives.
yield pauses a generator function* and returns a value to the caller. Calling .next() resumes execution. Used for lazy sequences, custom iterators, async control flow (co, redux-saga), and cooperative multitasking.
z-index controls the vertical stacking order of positioned elements. Only works on elements with position other than static. A new stacking context is created by position+z-index, opacity < 1, transform, filter, contain.
Zero-days are unknown vulnerabilities exploited before a patch exists. Mitigate by keeping dependencies up to date (npm audit, Dependabot), applying security patches promptly, and following security advisories.
"Never trust, always verify." Every request is authenticated and authorised — even from inside the network. Implemented with short-lived tokens, MFA, least-privilege access, network segmentation, and continuous monitoring.