LPI Web Dev Essentials cheat sheet
LPI Web Dev Essentials · Keep the key ideas within reach.
Software Development and Web Technologies
The HTTP request/response cycle: client sends method, path, headers, optional body; server returns status code, headers, body. Stateless by design, so state is carried by cookies, tokens, or server-side sessions.
Status code classes: 1xx informational, 2xx success (200 OK, 201 Created, 204 No Content), 3xx redirection (301 permanent, 302/307 temporary, 304 Not Modified), 4xx client error (400, 401 unauthenticated, 403 forbidden, 404, 405, 409, 422, 429), 5xx server error (500, 502, 503, 504).
Idempotent methods: GET, HEAD, PUT, DELETE, OPTIONS are idempotent; POST is not. Safe methods (no state change): GET, HEAD, OPTIONS. PUT replaces a full resource; PATCH applies a partial modification.
MIME types drive interpretation: text/html, text/css, application/javascript, application/json, image/png. Content-Type declares the body format; Accept negotiates it; charset (usually UTF-8) belongs in the Content-Type header.
Version control: a commit is an immutable snapshot identified by a hash; branches are movable pointers; merge creates a commit with two parents; rebase rewrites commits onto a new base and changes hashes.
REST constraints: client-server separation, statelessness, cacheability, uniform interface, layered system, optional code-on-demand. Resources are addressed by URIs and manipulated through representations.
DNS resolves a hostname to an IP address; TCP then establishes a connection; TLS adds encryption and identity. HTTPS defaults to port 443, HTTP to port 80, and the same-origin policy compares scheme, host, and port.
Semantic versioning MAJOR.MINOR.PATCH: MAJOR for incompatible API changes, MINOR for backward-compatible features, PATCH for backward-compatible fixes. A caret range (^1.2.3) allows MINOR and PATCH updates; a tilde (~1.2.3) allows PATCH only.
Build tooling roles: bundlers (webpack, esbuild, Vite) resolve and combine modules; transpilers (Babel, TypeScript) convert syntax; linters (ESLint) detect code issues; minifiers reduce size; source maps map output back to original sources.
HTML Document Markup
Document skeleton: first, then a single root containing (metadata) and (rendered content). The element is required in practice and supplies the browser tab and search-result text.</p>
Void (self-closing) elements have no end tag and cannot contain content: area, base, br, col, embed, hr, img, input, link, meta, param, source, track, wbr.
Heading elements
through express outline depth, not font size. Exactly one per page is the common convention; skipping levels breaks the document outline.Semantic landmarks:
, , (one per document), (thematic, usually with a heading), (self-contained), (tangential), . and are generic containers with no semantics.Lists:
- unordered,
- may be a direct child of
- or
- .
- ordered (with start, reversed, type attributes), description list pairing terms with descriptions. Only
- may be a direct child of
Forms:
; controls (text, email, password, checkbox, radio, file, hidden, submit, number, date),Table structure:
containing , , , , , then rows
of / . The scope attribute on declares row or column association for assistive technology. Global attributes: id (unique in the document), class (space-separated tokens), style, title, lang, dir, hidden, tabindex, data-* (custom data read via dataset), contenteditable, and ARIA attributes such as role and aria-label.
Embedding and media: requires alt (empty alt for decorative images); with enables art direction; / use and controls; embeds another browsing context and should carry a title.
CSS Content Styling
Cascade order (low to high precedence): user-agent styles, user styles, author styles, author !important, user !important. Within the same origin, specificity decides; then source order breaks ties.
Specificity as a four-part tuple (inline, IDs, classes/attributes/pseudo-classes, elements/pseudo-elements). (0,1,0,0) beats (0,0,5,3); :where() contributes zero specificity, :is() and :not() take the specificity of their most specific argument.
Box model: content, padding, border, margin. box-sizing: content-box adds padding and border outside width; border-box includes them, so width equals the visible box.
Display values: block, inline, inline-block, flex, grid, none. display:none removes the element from layout and the accessibility tree; visibility:hidden keeps the space but hides the box.
Flexbox: the container sets display:flex, flex-direction, justify-content (main axis), align-items (cross axis), gap, flex-wrap. Items use flex-grow, flex-shrink, flex-basis (shorthand flex).
Grid: display:grid with grid-template-columns/rows, fr units, repeat(), minmax(), auto-fit/auto-fill; placement via grid-column and grid-row (line numbers or spans); gap sets gutters.
Positioning: static (default), relative (offset from normal position, keeps space), absolute (removed from flow, positioned against nearest positioned ancestor), fixed (viewport), sticky (relative until a scroll threshold).
Responsive design: the viewport meta tag, fluid units (%, rem, vw/vh), and media queries such as @media (min-width: 768px). Mobile-first means base styles for small screens and min-width queries to enhance upward.
Custom properties (--name) are inherited and read with var(--name, fallback); they are resolved at computed-value time, which enables theming and runtime changes from JavaScript via style.setProperty.
JavaScript Programming
Declarations: var is function-scoped and hoisted as undefined; let and const are block-scoped and sit in the temporal dead zone until initialized. const prevents rebinding, not mutation of the referenced object.
Types: primitives (string, number, bigint, boolean, undefined, null, symbol) plus objects. typeof null returns "object"; NaN is a number and NaN !== NaN; use Number.isNaN or Object.is for reliable checks.
Equality: == applies type coercion, === does not. Falsy values are false, 0, -0, 0n, "", null, undefined, NaN; everything else, including [] and {}, is truthy.
Functions: declarations hoist fully; function expressions and arrow functions do not. Arrows have no own this, arguments, or new.target, so they inherit this lexically and cannot be constructors.
Scope and this: this in a normal function call is undefined in strict mode and the global object otherwise; as a method it is the receiver; call/apply/bind set it explicitly. Closures capture the enclosing lexical environment.
Arrays: map, filter, reduce, forEach, find, some, every, slice (non-mutating) versus splice (mutating), push/pop (end) versus shift/unshift (start), and spread [...] for shallow copies.
Asynchronous JavaScript: the event loop drains the call stack, then microtasks (promise callbacks, queueMicrotask), then macrotasks (timers, I/O). async functions return promises; await pauses inside the async function only.
Promises have three states: pending, fulfilled, rejected, and are settled once. Promise.all rejects on the first rejection; Promise.allSettled waits for all; Promise.race settles with the first result.
Modules and DOM: ES modules use import/export, are deferred, strict by default, and have their own top-level scope. DOM selection uses querySelector/querySelectorAll; events propagate through capture, target, and bubble phases, and addEventListener options include capture, once, and passive.
NodeJS Server Programming
Node is a single-threaded event loop running JavaScript on V8 with non-blocking I/O delegated to libuv's thread pool. Blocking the loop with synchronous CPU work stalls every concurrent request.
Event loop phases in order: timers, pending callbacks, idle/prepare, poll, check (setImmediate), close callbacks; process.nextTick and promise microtasks drain between each phase.
CommonJS uses require/module.exports and is synchronous; ES modules use import/export and are enabled by "type": "module" in package.json or the .mjs extension. package.json holds name, version, main/exports, scripts, and dependencies.
Core modules: fs (readFile/writeFile async, readFileSync blocking), path (join, resolve, dirname, extname), http (createServer), os, url, crypto, events (EventEmitter with on/emit), stream, and process (argv, env, exit).
Error-first callbacks take (err, data); promises and async/await are preferred for sequencing. Unhandled rejections and uncaught exceptions terminate the process by default, so wrap awaited work in try/catch.
A minimal HTTP server: http.createServer((req, res) => {...}) then server.listen(port, callback). req.method and req.url identify the request; res.writeHead(status, headers) and res.end(body) send the response.
Express: app.get/post/use define routes and middleware; middleware signature (req, res, next) runs in registration order; next(err) forwards to error-handling middleware with four arguments (err, req, res, next).
Environment configuration: read secrets and ports from process.env (populated by dotenv or the platform), never hard-code them. NODE_ENV=production commonly disables development logging and enables caching.
npm essentials: npm init, npm install (--save-dev for tooling), package-lock.json pins the resolved dependency tree, and the scripts block exposes commands run with npm run .
CSS Content Styling
Cascade order (low to high precedence): user-agent styles, user styles, author styles, author !important, user !important. Within the same origin, specificity decides; then source order breaks ties.
Specificity as a four-part tuple (inline, IDs, classes/attributes/pseudo-classes, elements/pseudo-elements). (0,1,0,0) beats (0,0,5,3); :where() contributes zero specificity, :is() and :not() take the specificity of their most specific argument.
Box model: content, padding, border, margin. box-sizing: content-box adds padding and border outside width; border-box includes them, so width equals the visible box.
Display values: block, inline, inline-block, flex, grid, none. display:none removes the element from layout and the accessibility tree; visibility:hidden keeps the space but hides the box.
Flexbox: the container sets display:flex, flex-direction, justify-content (main axis), align-items (cross axis), gap, flex-wrap. Items use flex-grow, flex-shrink, flex-basis (shorthand flex).
Grid: display:grid with grid-template-columns/rows, fr units, repeat(), minmax(), auto-fit/auto-fill; placement via grid-column and grid-row (line numbers or spans); gap sets gutters.
Positioning: static (default), relative (offset from normal position, keeps space), absolute (removed from flow, positioned against nearest positioned ancestor), fixed (viewport), sticky (relative until a scroll threshold).
Responsive design: the viewport meta tag, fluid units (%, rem, vw/vh), and media queries such as @media (min-width: 768px). Mobile-first means base styles for small screens and min-width queries to enhance upward.
Custom properties (--name) are inherited and read with var(--name, fallback); they are resolved at computed-value time, which enables theming and runtime changes from JavaScript via style.setProperty.
JavaScript Programming
Declarations: var is function-scoped and hoisted as undefined; let and const are block-scoped and sit in the temporal dead zone until initialized. const prevents rebinding, not mutation of the referenced object.
Types: primitives (string, number, bigint, boolean, undefined, null, symbol) plus objects. typeof null returns "object"; NaN is a number and NaN !== NaN; use Number.isNaN or Object.is for reliable checks.
Equality: == applies type coercion, === does not. Falsy values are false, 0, -0, 0n, "", null, undefined, NaN; everything else, including [] and {}, is truthy.
Functions: declarations hoist fully; function expressions and arrow functions do not. Arrows have no own this, arguments, or new.target, so they inherit this lexically and cannot be constructors.
Scope and this: this in a normal function call is undefined in strict mode and the global object otherwise; as a method it is the receiver; call/apply/bind set it explicitly. Closures capture the enclosing lexical environment.
Arrays: map, filter, reduce, forEach, find, some, every, slice (non-mutating) versus splice (mutating), push/pop (end) versus shift/unshift (start), and spread [...] for shallow copies.
Asynchronous JavaScript: the event loop drains the call stack, then microtasks (promise callbacks, queueMicrotask), then macrotasks (timers, I/O). async functions return promises; await pauses inside the async function only.
Promises have three states: pending, fulfilled, rejected, and are settled once. Promise.all rejects on the first rejection; Promise.allSettled waits for all; Promise.race settles with the first result.
Modules and DOM: ES modules use import/export, are deferred, strict by default, and have their own top-level scope. DOM selection uses querySelector/querySelectorAll; events propagate through capture, target, and bubble phases, and addEventListener options include capture, once, and passive.
NodeJS Server Programming
Node is a single-threaded event loop running JavaScript on V8 with non-blocking I/O delegated to libuv's thread pool. Blocking the loop with synchronous CPU work stalls every concurrent request.
Event loop phases in order: timers, pending callbacks, idle/prepare, poll, check (setImmediate), close callbacks; process.nextTick and promise microtasks drain between each phase.
CommonJS uses require/module.exports and is synchronous; ES modules use import/export and are enabled by "type": "module" in package.json or the .mjs extension. package.json holds name, version, main/exports, scripts, and dependencies.
Core modules: fs (readFile/writeFile async, readFileSync blocking), path (join, resolve, dirname, extname), http (createServer), os, url, crypto, events (EventEmitter with on/emit), stream, and process (argv, env, exit).
Error-first callbacks take (err, data); promises and async/await are preferred for sequencing. Unhandled rejections and uncaught exceptions terminate the process by default, so wrap awaited work in try/catch.
A minimal HTTP server: http.createServer((req, res) => {...}) then server.listen(port, callback). req.method and req.url identify the request; res.writeHead(status, headers) and res.end(body) send the response.
Express: app.get/post/use define routes and middleware; middleware signature (req, res, next) runs in registration order; next(err) forwards to error-handling middleware with four arguments (err, req, res, next).
Environment configuration: read secrets and ports from process.env (populated by dotenv or the platform), never hard-code them. NODE_ENV=production commonly disables development logging and enables caching.
npm essentials: npm init, npm install (--save-dev for tooling), package-lock.json pins the resolved dependency tree, and the scripts block exposes commands run with npm run .
Software Development and Web Technologies
The HTTP request/response cycle: client sends method, path, headers, optional body; server returns status code, headers, body. Stateless by design, so state is carried by cookies, tokens, or server-side sessions.
Status code classes: 1xx informational, 2xx success (200 OK, 201 Created, 204 No Content), 3xx redirection (301 permanent, 302/307 temporary, 304 Not Modified), 4xx client error (400, 401 unauthenticated, 403 forbidden, 404, 405, 409, 422, 429), 5xx server error (500, 502, 503, 504).
Idempotent methods: GET, HEAD, PUT, DELETE, OPTIONS are idempotent; POST is not. Safe methods (no state change): GET, HEAD, OPTIONS. PUT replaces a full resource; PATCH applies a partial modification.
MIME types drive interpretation: text/html, text/css, application/javascript, application/json, image/png. Content-Type declares the body format; Accept negotiates it; charset (usually UTF-8) belongs in the Content-Type header.
Version control: a commit is an immutable snapshot identified by a hash; branches are movable pointers; merge creates a commit with two parents; rebase rewrites commits onto a new base and changes hashes.
REST constraints: client-server separation, statelessness, cacheability, uniform interface, layered system, optional code-on-demand. Resources are addressed by URIs and manipulated through representations.
DNS resolves a hostname to an IP address; TCP then establishes a connection; TLS adds encryption and identity. HTTPS defaults to port 443, HTTP to port 80, and the same-origin policy compares scheme, host, and port.
Semantic versioning MAJOR.MINOR.PATCH: MAJOR for incompatible API changes, MINOR for backward-compatible features, PATCH for backward-compatible fixes. A caret range (^1.2.3) allows MINOR and PATCH updates; a tilde (~1.2.3) allows PATCH only.
Build tooling roles: bundlers (webpack, esbuild, Vite) resolve and combine modules; transpilers (Babel, TypeScript) convert syntax; linters (ESLint) detect code issues; minifiers reduce size; source maps map output back to original sources.
HTML Document Markup
Document skeleton: first, then a single root containing (metadata) and (rendered content). The element is required in practice and supplies the browser tab and search-result text.</p>
Void (self-closing) elements have no end tag and cannot contain content: area, base, br, col, embed, hr, img, input, link, meta, param, source, track, wbr.
Heading elements
through express outline depth, not font size. Exactly one per page is the common convention; skipping levels breaks the document outline.Semantic landmarks:
, , (one per document), (thematic, usually with a heading), (self-contained), (tangential), . and are generic containers with no semantics.Lists:
- unordered,
- may be a direct child of
- or
- .
- ordered (with start, reversed, type attributes), description list pairing terms with descriptions. Only
- may be a direct child of
Forms:
; controls (text, email, password, checkbox, radio, file, hidden, submit, number, date),Table structure:
containing , , , , , then rows
of / . The scope attribute on declares row or column association for assistive technology. Global attributes: id (unique in the document), class (space-separated tokens), style, title, lang, dir, hidden, tabindex, data-* (custom data read via dataset), contenteditable, and ARIA attributes such as role and aria-label.
Embedding and media: requires alt (empty alt for decorative images); with enables art direction; / use and controls; embeds another browsing context and should carry a title.
CSS Content Styling
Cascade order (low to high precedence): user-agent styles, user styles, author styles, author !important, user !important. Within the same origin, specificity decides; then source order breaks ties.
Specificity as a four-part tuple (inline, IDs, classes/attributes/pseudo-classes, elements/pseudo-elements). (0,1,0,0) beats (0,0,5,3); :where() contributes zero specificity, :is() and :not() take the specificity of their most specific argument.
Box model: content, padding, border, margin. box-sizing: content-box adds padding and border outside width; border-box includes them, so width equals the visible box.
Display values: block, inline, inline-block, flex, grid, none. display:none removes the element from layout and the accessibility tree; visibility:hidden keeps the space but hides the box.
Flexbox: the container sets display:flex, flex-direction, justify-content (main axis), align-items (cross axis), gap, flex-wrap. Items use flex-grow, flex-shrink, flex-basis (shorthand flex).
Grid: display:grid with grid-template-columns/rows, fr units, repeat(), minmax(), auto-fit/auto-fill; placement via grid-column and grid-row (line numbers or spans); gap sets gutters.
Positioning: static (default), relative (offset from normal position, keeps space), absolute (removed from flow, positioned against nearest positioned ancestor), fixed (viewport), sticky (relative until a scroll threshold).
Responsive design: the viewport meta tag, fluid units (%, rem, vw/vh), and media queries such as @media (min-width: 768px). Mobile-first means base styles for small screens and min-width queries to enhance upward.
Custom properties (--name) are inherited and read with var(--name, fallback); they are resolved at computed-value time, which enables theming and runtime changes from JavaScript via style.setProperty.
JavaScript Programming
Declarations: var is function-scoped and hoisted as undefined; let and const are block-scoped and sit in the temporal dead zone until initialized. const prevents rebinding, not mutation of the referenced object.
Types: primitives (string, number, bigint, boolean, undefined, null, symbol) plus objects. typeof null returns "object"; NaN is a number and NaN !== NaN; use Number.isNaN or Object.is for reliable checks.
Equality: == applies type coercion, === does not. Falsy values are false, 0, -0, 0n, "", null, undefined, NaN; everything else, including [] and {}, is truthy.
Functions: declarations hoist fully; function expressions and arrow functions do not. Arrows have no own this, arguments, or new.target, so they inherit this lexically and cannot be constructors.
Scope and this: this in a normal function call is undefined in strict mode and the global object otherwise; as a method it is the receiver; call/apply/bind set it explicitly. Closures capture the enclosing lexical environment.
Arrays: map, filter, reduce, forEach, find, some, every, slice (non-mutating) versus splice (mutating), push/pop (end) versus shift/unshift (start), and spread [...] for shallow copies.
Asynchronous JavaScript: the event loop drains the call stack, then microtasks (promise callbacks, queueMicrotask), then macrotasks (timers, I/O). async functions return promises; await pauses inside the async function only.
Promises have three states: pending, fulfilled, rejected, and are settled once. Promise.all rejects on the first rejection; Promise.allSettled waits for all; Promise.race settles with the first result.
Modules and DOM: ES modules use import/export, are deferred, strict by default, and have their own top-level scope. DOM selection uses querySelector/querySelectorAll; events propagate through capture, target, and bubble phases, and addEventListener options include capture, once, and passive.
NodeJS Server Programming
Node is a single-threaded event loop running JavaScript on V8 with non-blocking I/O delegated to libuv's thread pool. Blocking the loop with synchronous CPU work stalls every concurrent request.
Event loop phases in order: timers, pending callbacks, idle/prepare, poll, check (setImmediate), close callbacks; process.nextTick and promise microtasks drain between each phase.
CommonJS uses require/module.exports and is synchronous; ES modules use import/export and are enabled by "type": "module" in package.json or the .mjs extension. package.json holds name, version, main/exports, scripts, and dependencies.
Core modules: fs (readFile/writeFile async, readFileSync blocking), path (join, resolve, dirname, extname), http (createServer), os, url, crypto, events (EventEmitter with on/emit), stream, and process (argv, env, exit).
Error-first callbacks take (err, data); promises and async/await are preferred for sequencing. Unhandled rejections and uncaught exceptions terminate the process by default, so wrap awaited work in try/catch.
A minimal HTTP server: http.createServer((req, res) => {...}) then server.listen(port, callback). req.method and req.url identify the request; res.writeHead(status, headers) and res.end(body) send the response.
Express: app.get/post/use define routes and middleware; middleware signature (req, res, next) runs in registration order; next(err) forwards to error-handling middleware with four arguments (err, req, res, next).
Environment configuration: read secrets and ports from process.env (populated by dotenv or the platform), never hard-code them. NODE_ENV=production commonly disables development logging and enables caching.
npm essentials: npm init, npm install (--save-dev for tooling), package-lock.json pins the resolved dependency tree, and the scripts block exposes commands run with npm run .
Software Development and Web Technologies
The HTTP request/response cycle: client sends method, path, headers, optional body; server returns status code, headers, body. Stateless by design, so state is carried by cookies, tokens, or server-side sessions.
Status code classes: 1xx informational, 2xx success (200 OK, 201 Created, 204 No Content), 3xx redirection (301 permanent, 302/307 temporary, 304 Not Modified), 4xx client error (400, 401 unauthenticated, 403 forbidden, 404, 405, 409, 422, 429), 5xx server error (500, 502, 503, 504).
Idempotent methods: GET, HEAD, PUT, DELETE, OPTIONS are idempotent; POST is not. Safe methods (no state change): GET, HEAD, OPTIONS. PUT replaces a full resource; PATCH applies a partial modification.
MIME types drive interpretation: text/html, text/css, application/javascript, application/json, image/png. Content-Type declares the body format; Accept negotiates it; charset (usually UTF-8) belongs in the Content-Type header.
Version control: a commit is an immutable snapshot identified by a hash; branches are movable pointers; merge creates a commit with two parents; rebase rewrites commits onto a new base and changes hashes.
REST constraints: client-server separation, statelessness, cacheability, uniform interface, layered system, optional code-on-demand. Resources are addressed by URIs and manipulated through representations.
DNS resolves a hostname to an IP address; TCP then establishes a connection; TLS adds encryption and identity. HTTPS defaults to port 443, HTTP to port 80, and the same-origin policy compares scheme, host, and port.
Semantic versioning MAJOR.MINOR.PATCH: MAJOR for incompatible API changes, MINOR for backward-compatible features, PATCH for backward-compatible fixes. A caret range (^1.2.3) allows MINOR and PATCH updates; a tilde (~1.2.3) allows PATCH only.
Build tooling roles: bundlers (webpack, esbuild, Vite) resolve and combine modules; transpilers (Babel, TypeScript) convert syntax; linters (ESLint) detect code issues; minifiers reduce size; source maps map output back to original sources.
HTML Document Markup
Document skeleton: first, then a single root containing (metadata) and (rendered content). The element is required in practice and supplies the browser tab and search-result text.</p>
Void (self-closing) elements have no end tag and cannot contain content: area, base, br, col, embed, hr, img, input, link, meta, param, source, track, wbr.
Heading elements
through express outline depth, not font size. Exactly one per page is the common convention; skipping levels breaks the document outline.Semantic landmarks:
, , (one per document), (thematic, usually with a heading), (self-contained), (tangential), . and are generic containers with no semantics.Lists:
- unordered,
- may be a direct child of
- or
- .
- ordered (with start, reversed, type attributes), description list pairing terms with descriptions. Only
- may be a direct child of
Forms:
; controls (text, email, password, checkbox, radio, file, hidden, submit, number, date),Table structure:
containing , , , , , then rows
of / . The scope attribute on declares row or column association for assistive technology. Global attributes: id (unique in the document), class (space-separated tokens), style, title, lang, dir, hidden, tabindex, data-* (custom data read via dataset), contenteditable, and ARIA attributes such as role and aria-label.
Embedding and media: requires alt (empty alt for decorative images); with enables art direction; / use and controls; embeds another browsing context and should carry a title.
CSS Content Styling
Cascade order (low to high precedence): user-agent styles, user styles, author styles, author !important, user !important. Within the same origin, specificity decides; then source order breaks ties.
Specificity as a four-part tuple (inline, IDs, classes/attributes/pseudo-classes, elements/pseudo-elements). (0,1,0,0) beats (0,0,5,3); :where() contributes zero specificity, :is() and :not() take the specificity of their most specific argument.
Box model: content, padding, border, margin. box-sizing: content-box adds padding and border outside width; border-box includes them, so width equals the visible box.
Display values: block, inline, inline-block, flex, grid, none. display:none removes the element from layout and the accessibility tree; visibility:hidden keeps the space but hides the box.
Flexbox: the container sets display:flex, flex-direction, justify-content (main axis), align-items (cross axis), gap, flex-wrap. Items use flex-grow, flex-shrink, flex-basis (shorthand flex).
Grid: display:grid with grid-template-columns/rows, fr units, repeat(), minmax(), auto-fit/auto-fill; placement via grid-column and grid-row (line numbers or spans); gap sets gutters.
Positioning: static (default), relative (offset from normal position, keeps space), absolute (removed from flow, positioned against nearest positioned ancestor), fixed (viewport), sticky (relative until a scroll threshold).
Responsive design: the viewport meta tag, fluid units (%, rem, vw/vh), and media queries such as @media (min-width: 768px). Mobile-first means base styles for small screens and min-width queries to enhance upward.
Custom properties (--name) are inherited and read with var(--name, fallback); they are resolved at computed-value time, which enables theming and runtime changes from JavaScript via style.setProperty.
JavaScript Programming
Declarations: var is function-scoped and hoisted as undefined; let and const are block-scoped and sit in the temporal dead zone until initialized. const prevents rebinding, not mutation of the referenced object.
Types: primitives (string, number, bigint, boolean, undefined, null, symbol) plus objects. typeof null returns "object"; NaN is a number and NaN !== NaN; use Number.isNaN or Object.is for reliable checks.
Equality: == applies type coercion, === does not. Falsy values are false, 0, -0, 0n, "", null, undefined, NaN; everything else, including [] and {}, is truthy.
Functions: declarations hoist fully; function expressions and arrow functions do not. Arrows have no own this, arguments, or new.target, so they inherit this lexically and cannot be constructors.
Scope and this: this in a normal function call is undefined in strict mode and the global object otherwise; as a method it is the receiver; call/apply/bind set it explicitly. Closures capture the enclosing lexical environment.
Arrays: map, filter, reduce, forEach, find, some, every, slice (non-mutating) versus splice (mutating), push/pop (end) versus shift/unshift (start), and spread [...] for shallow copies.
Asynchronous JavaScript: the event loop drains the call stack, then microtasks (promise callbacks, queueMicrotask), then macrotasks (timers, I/O). async functions return promises; await pauses inside the async function only.
Promises have three states: pending, fulfilled, rejected, and are settled once. Promise.all rejects on the first rejection; Promise.allSettled waits for all; Promise.race settles with the first result.
Modules and DOM: ES modules use import/export, are deferred, strict by default, and have their own top-level scope. DOM selection uses querySelector/querySelectorAll; events propagate through capture, target, and bubble phases, and addEventListener options include capture, once, and passive.
NodeJS Server Programming
Node is a single-threaded event loop running JavaScript on V8 with non-blocking I/O delegated to libuv's thread pool. Blocking the loop with synchronous CPU work stalls every concurrent request.
Event loop phases in order: timers, pending callbacks, idle/prepare, poll, check (setImmediate), close callbacks; process.nextTick and promise microtasks drain between each phase.
CommonJS uses require/module.exports and is synchronous; ES modules use import/export and are enabled by "type": "module" in package.json or the .mjs extension. package.json holds name, version, main/exports, scripts, and dependencies.
Core modules: fs (readFile/writeFile async, readFileSync blocking), path (join, resolve, dirname, extname), http (createServer), os, url, crypto, events (EventEmitter with on/emit), stream, and process (argv, env, exit).
Error-first callbacks take (err, data); promises and async/await are preferred for sequencing. Unhandled rejections and uncaught exceptions terminate the process by default, so wrap awaited work in try/catch.
A minimal HTTP server: http.createServer((req, res) => {...}) then server.listen(port, callback). req.method and req.url identify the request; res.writeHead(status, headers) and res.end(body) send the response.
Express: app.get/post/use define routes and middleware; middleware signature (req, res, next) runs in registration order; next(err) forwards to error-handling middleware with four arguments (err, req, res, next).
Environment configuration: read secrets and ports from process.env (populated by dotenv or the platform), never hard-code them. NODE_ENV=production commonly disables development logging and enables caching.
npm essentials: npm init, npm install (--save-dev for tooling), package-lock.json pins the resolved dependency tree, and the scripts block exposes commands run with npm run .
Software Development and Web Technologies
The HTTP request/response cycle: client sends method, path, headers, optional body; server returns status code, headers, body. Stateless by design, so state is carried by cookies, tokens, or server-side sessions.
Status code classes: 1xx informational, 2xx success (200 OK, 201 Created, 204 No Content), 3xx redirection (301 permanent, 302/307 temporary, 304 Not Modified), 4xx client error (400, 401 unauthenticated, 403 forbidden, 404, 405, 409, 422, 429), 5xx server error (500, 502, 503, 504).
Idempotent methods: GET, HEAD, PUT, DELETE, OPTIONS are idempotent; POST is not. Safe methods (no state change): GET, HEAD, OPTIONS. PUT replaces a full resource; PATCH applies a partial modification.
MIME types drive interpretation: text/html, text/css, application/javascript, application/json, image/png. Content-Type declares the body format; Accept negotiates it; charset (usually UTF-8) belongs in the Content-Type header.
Version control: a commit is an immutable snapshot identified by a hash; branches are movable pointers; merge creates a commit with two parents; rebase rewrites commits onto a new base and changes hashes.
REST constraints: client-server separation, statelessness, cacheability, uniform interface, layered system, optional code-on-demand. Resources are addressed by URIs and manipulated through representations.
DNS resolves a hostname to an IP address; TCP then establishes a connection; TLS adds encryption and identity. HTTPS defaults to port 443, HTTP to port 80, and the same-origin policy compares scheme, host, and port.
Semantic versioning MAJOR.MINOR.PATCH: MAJOR for incompatible API changes, MINOR for backward-compatible features, PATCH for backward-compatible fixes. A caret range (^1.2.3) allows MINOR and PATCH updates; a tilde (~1.2.3) allows PATCH only.
Build tooling roles: bundlers (webpack, esbuild, Vite) resolve and combine modules; transpilers (Babel, TypeScript) convert syntax; linters (ESLint) detect code issues; minifiers reduce size; source maps map output back to original sources.
HTML Document Markup
Document skeleton: first, then a single root containing (metadata) and (rendered content). The element is required in practice and supplies the browser tab and search-result text.</p>
Void (self-closing) elements have no end tag and cannot contain content: area, base, br, col, embed, hr, img, input, link, meta, param, source, track, wbr.
Heading elements
through express outline depth, not font size. Exactly one per page is the common convention; skipping levels breaks the document outline.Semantic landmarks:
, , (one per document), (thematic, usually with a heading), (self-contained), (tangential), . and are generic containers with no semantics.Lists:
- unordered,
- may be a direct child of
- or
- .
- ordered (with start, reversed, type attributes), description list pairing terms with descriptions. Only
- may be a direct child of
Forms:
; controls (text, email, password, checkbox, radio, file, hidden, submit, number, date),Table structure:
containing , , , , , then rows
of / . The scope attribute on declares row or column association for assistive technology. Global attributes: id (unique in the document), class (space-separated tokens), style, title, lang, dir, hidden, tabindex, data-* (custom data read via dataset), contenteditable, and ARIA attributes such as role and aria-label.
Embedding and media: requires alt (empty alt for decorative images); with enables art direction; / use and controls; embeds another browsing context and should carry a title.
CSS Content Styling
Cascade order (low to high precedence): user-agent styles, user styles, author styles, author !important, user !important. Within the same origin, specificity decides; then source order breaks ties.
Specificity as a four-part tuple (inline, IDs, classes/attributes/pseudo-classes, elements/pseudo-elements). (0,1,0,0) beats (0,0,5,3); :where() contributes zero specificity, :is() and :not() take the specificity of their most specific argument.
Box model: content, padding, border, margin. box-sizing: content-box adds padding and border outside width; border-box includes them, so width equals the visible box.
Display values: block, inline, inline-block, flex, grid, none. display:none removes the element from layout and the accessibility tree; visibility:hidden keeps the space but hides the box.
Flexbox: the container sets display:flex, flex-direction, justify-content (main axis), align-items (cross axis), gap, flex-wrap. Items use flex-grow, flex-shrink, flex-basis (shorthand flex).
Grid: display:grid with grid-template-columns/rows, fr units, repeat(), minmax(), auto-fit/auto-fill; placement via grid-column and grid-row (line numbers or spans); gap sets gutters.
Positioning: static (default), relative (offset from normal position, keeps space), absolute (removed from flow, positioned against nearest positioned ancestor), fixed (viewport), sticky (relative until a scroll threshold).
Responsive design: the viewport meta tag, fluid units (%, rem, vw/vh), and media queries such as @media (min-width: 768px). Mobile-first means base styles for small screens and min-width queries to enhance upward.
Custom properties (--name) are inherited and read with var(--name, fallback); they are resolved at computed-value time, which enables theming and runtime changes from JavaScript via style.setProperty.
JavaScript Programming
Declarations: var is function-scoped and hoisted as undefined; let and const are block-scoped and sit in the temporal dead zone until initialized. const prevents rebinding, not mutation of the referenced object.
Types: primitives (string, number, bigint, boolean, undefined, null, symbol) plus objects. typeof null returns "object"; NaN is a number and NaN !== NaN; use Number.isNaN or Object.is for reliable checks.
Equality: == applies type coercion, === does not. Falsy values are false, 0, -0, 0n, "", null, undefined, NaN; everything else, including [] and {}, is truthy.
Functions: declarations hoist fully; function expressions and arrow functions do not. Arrows have no own this, arguments, or new.target, so they inherit this lexically and cannot be constructors.
Scope and this: this in a normal function call is undefined in strict mode and the global object otherwise; as a method it is the receiver; call/apply/bind set it explicitly. Closures capture the enclosing lexical environment.
Arrays: map, filter, reduce, forEach, find, some, every, slice (non-mutating) versus splice (mutating), push/pop (end) versus shift/unshift (start), and spread [...] for shallow copies.
Asynchronous JavaScript: the event loop drains the call stack, then microtasks (promise callbacks, queueMicrotask), then macrotasks (timers, I/O). async functions return promises; await pauses inside the async function only.
Promises have three states: pending, fulfilled, rejected, and are settled once. Promise.all rejects on the first rejection; Promise.allSettled waits for all; Promise.race settles with the first result.
Modules and DOM: ES modules use import/export, are deferred, strict by default, and have their own top-level scope. DOM selection uses querySelector/querySelectorAll; events propagate through capture, target, and bubble phases, and addEventListener options include capture, once, and passive.
NodeJS Server Programming
Node is a single-threaded event loop running JavaScript on V8 with non-blocking I/O delegated to libuv's thread pool. Blocking the loop with synchronous CPU work stalls every concurrent request.
Event loop phases in order: timers, pending callbacks, idle/prepare, poll, check (setImmediate), close callbacks; process.nextTick and promise microtasks drain between each phase.
CommonJS uses require/module.exports and is synchronous; ES modules use import/export and are enabled by "type": "module" in package.json or the .mjs extension. package.json holds name, version, main/exports, scripts, and dependencies.
Core modules: fs (readFile/writeFile async, readFileSync blocking), path (join, resolve, dirname, extname), http (createServer), os, url, crypto, events (EventEmitter with on/emit), stream, and process (argv, env, exit).
Error-first callbacks take (err, data); promises and async/await are preferred for sequencing. Unhandled rejections and uncaught exceptions terminate the process by default, so wrap awaited work in try/catch.
A minimal HTTP server: http.createServer((req, res) => {...}) then server.listen(port, callback). req.method and req.url identify the request; res.writeHead(status, headers) and res.end(body) send the response.
Express: app.get/post/use define routes and middleware; middleware signature (req, res, next) runs in registration order; next(err) forwards to error-handling middleware with four arguments (err, req, res, next).
Environment configuration: read secrets and ports from process.env (populated by dotenv or the platform), never hard-code them. NODE_ENV=production commonly disables development logging and enables caching.
npm essentials: npm init, npm install (--save-dev for tooling), package-lock.json pins the resolved dependency tree, and the scripts block exposes commands run with npm run .
Software Development and Web Technologies
The HTTP request/response cycle: client sends method, path, headers, optional body; server returns status code, headers, body. Stateless by design, so state is carried by cookies, tokens, or server-side sessions.
Status code classes: 1xx informational, 2xx success (200 OK, 201 Created, 204 No Content), 3xx redirection (301 permanent, 302/307 temporary, 304 Not Modified), 4xx client error (400, 401 unauthenticated, 403 forbidden, 404, 405, 409, 422, 429), 5xx server error (500, 502, 503, 504).
Idempotent methods: GET, HEAD, PUT, DELETE, OPTIONS are idempotent; POST is not. Safe methods (no state change): GET, HEAD, OPTIONS. PUT replaces a full resource; PATCH applies a partial modification.
MIME types drive interpretation: text/html, text/css, application/javascript, application/json, image/png. Content-Type declares the body format; Accept negotiates it; charset (usually UTF-8) belongs in the Content-Type header.
Version control: a commit is an immutable snapshot identified by a hash; branches are movable pointers; merge creates a commit with two parents; rebase rewrites commits onto a new base and changes hashes.
REST constraints: client-server separation, statelessness, cacheability, uniform interface, layered system, optional code-on-demand. Resources are addressed by URIs and manipulated through representations.
DNS resolves a hostname to an IP address; TCP then establishes a connection; TLS adds encryption and identity. HTTPS defaults to port 443, HTTP to port 80, and the same-origin policy compares scheme, host, and port.
Semantic versioning MAJOR.MINOR.PATCH: MAJOR for incompatible API changes, MINOR for backward-compatible features, PATCH for backward-compatible fixes. A caret range (^1.2.3) allows MINOR and PATCH updates; a tilde (~1.2.3) allows PATCH only.
Build tooling roles: bundlers (webpack, esbuild, Vite) resolve and combine modules; transpilers (Babel, TypeScript) convert syntax; linters (ESLint) detect code issues; minifiers reduce size; source maps map output back to original sources.
HTML Document Markup
Document skeleton: first, then a single root containing (metadata) and (rendered content). The element is required in practice and supplies the browser tab and search-result text.</p>
Void (self-closing) elements have no end tag and cannot contain content: area, base, br, col, embed, hr, img, input, link, meta, param, source, track, wbr.
Heading elements
through express outline depth, not font size. Exactly one per page is the common convention; skipping levels breaks the document outline.Semantic landmarks:
, , (one per document), (thematic, usually with a heading), (self-contained), (tangential), . and are generic containers with no semantics.Lists:
- unordered,
- may be a direct child of
- or
- .
- ordered (with start, reversed, type attributes), description list pairing terms with descriptions. Only
- may be a direct child of
Forms:
; controls (text, email, password, checkbox, radio, file, hidden, submit, number, date),Table structure:
containing , , , , , then rows
of / . The scope attribute on declares row or column association for assistive technology. Global attributes: id (unique in the document), class (space-separated tokens), style, title, lang, dir, hidden, tabindex, data-* (custom data read via dataset), contenteditable, and ARIA attributes such as role and aria-label.
Embedding and media: requires alt (empty alt for decorative images); with enables art direction; / use and controls; embeds another browsing context and should carry a title.
CSS Content Styling
Cascade order (low to high precedence): user-agent styles, user styles, author styles, author !important, user !important. Within the same origin, specificity decides; then source order breaks ties.
Specificity as a four-part tuple (inline, IDs, classes/attributes/pseudo-classes, elements/pseudo-elements). (0,1,0,0) beats (0,0,5,3); :where() contributes zero specificity, :is() and :not() take the specificity of their most specific argument.
Box model: content, padding, border, margin. box-sizing: content-box adds padding and border outside width; border-box includes them, so width equals the visible box.
Display values: block, inline, inline-block, flex, grid, none. display:none removes the element from layout and the accessibility tree; visibility:hidden keeps the space but hides the box.
Flexbox: the container sets display:flex, flex-direction, justify-content (main axis), align-items (cross axis), gap, flex-wrap. Items use flex-grow, flex-shrink, flex-basis (shorthand flex).
Grid: display:grid with grid-template-columns/rows, fr units, repeat(), minmax(), auto-fit/auto-fill; placement via grid-column and grid-row (line numbers or spans); gap sets gutters.
Positioning: static (default), relative (offset from normal position, keeps space), absolute (removed from flow, positioned against nearest positioned ancestor), fixed (viewport), sticky (relative until a scroll threshold).
Responsive design: the viewport meta tag, fluid units (%, rem, vw/vh), and media queries such as @media (min-width: 768px). Mobile-first means base styles for small screens and min-width queries to enhance upward.
Custom properties (--name) are inherited and read with var(--name, fallback); they are resolved at computed-value time, which enables theming and runtime changes from JavaScript via style.setProperty.
JavaScript Programming
Declarations: var is function-scoped and hoisted as undefined; let and const are block-scoped and sit in the temporal dead zone until initialized. const prevents rebinding, not mutation of the referenced object.
Types: primitives (string, number, bigint, boolean, undefined, null, symbol) plus objects. typeof null returns "object"; NaN is a number and NaN !== NaN; use Number.isNaN or Object.is for reliable checks.
Equality: == applies type coercion, === does not. Falsy values are false, 0, -0, 0n, "", null, undefined, NaN; everything else, including [] and {}, is truthy.
Functions: declarations hoist fully; function expressions and arrow functions do not. Arrows have no own this, arguments, or new.target, so they inherit this lexically and cannot be constructors.
Scope and this: this in a normal function call is undefined in strict mode and the global object otherwise; as a method it is the receiver; call/apply/bind set it explicitly. Closures capture the enclosing lexical environment.
Arrays: map, filter, reduce, forEach, find, some, every, slice (non-mutating) versus splice (mutating), push/pop (end) versus shift/unshift (start), and spread [...] for shallow copies.
Asynchronous JavaScript: the event loop drains the call stack, then microtasks (promise callbacks, queueMicrotask), then macrotasks (timers, I/O). async functions return promises; await pauses inside the async function only.
Promises have three states: pending, fulfilled, rejected, and are settled once. Promise.all rejects on the first rejection; Promise.allSettled waits for all; Promise.race settles with the first result.
Modules and DOM: ES modules use import/export, are deferred, strict by default, and have their own top-level scope. DOM selection uses querySelector/querySelectorAll; events propagate through capture, target, and bubble phases, and addEventListener options include capture, once, and passive.
NodeJS Server Programming
Node is a single-threaded event loop running JavaScript on V8 with non-blocking I/O delegated to libuv's thread pool. Blocking the loop with synchronous CPU work stalls every concurrent request.
Event loop phases in order: timers, pending callbacks, idle/prepare, poll, check (setImmediate), close callbacks; process.nextTick and promise microtasks drain between each phase.
CommonJS uses require/module.exports and is synchronous; ES modules use import/export and are enabled by "type": "module" in package.json or the .mjs extension. package.json holds name, version, main/exports, scripts, and dependencies.
Core modules: fs (readFile/writeFile async, readFileSync blocking), path (join, resolve, dirname, extname), http (createServer), os, url, crypto, events (EventEmitter with on/emit), stream, and process (argv, env, exit).
Error-first callbacks take (err, data); promises and async/await are preferred for sequencing. Unhandled rejections and uncaught exceptions terminate the process by default, so wrap awaited work in try/catch.
A minimal HTTP server: http.createServer((req, res) => {...}) then server.listen(port, callback). req.method and req.url identify the request; res.writeHead(status, headers) and res.end(body) send the response.
Express: app.get/post/use define routes and middleware; middleware signature (req, res, next) runs in registration order; next(err) forwards to error-handling middleware with four arguments (err, req, res, next).
Environment configuration: read secrets and ports from process.env (populated by dotenv or the platform), never hard-code them. NODE_ENV=production commonly disables development logging and enables caching.
npm essentials: npm init, npm install (--save-dev for tooling), package-lock.json pins the resolved dependency tree, and the scripts block exposes commands run with npm run .
Software Development and Web Technologies
The HTTP request/response cycle: client sends method, path, headers, optional body; server returns status code, headers, body. Stateless by design, so state is carried by cookies, tokens, or server-side sessions.
Status code classes: 1xx informational, 2xx success (200 OK, 201 Created, 204 No Content), 3xx redirection (301 permanent, 302/307 temporary, 304 Not Modified), 4xx client error (400, 401 unauthenticated, 403 forbidden, 404, 405, 409, 422, 429), 5xx server error (500, 502, 503, 504).
Idempotent methods: GET, HEAD, PUT, DELETE, OPTIONS are idempotent; POST is not. Safe methods (no state change): GET, HEAD, OPTIONS. PUT replaces a full resource; PATCH applies a partial modification.
MIME types drive interpretation: text/html, text/css, application/javascript, application/json, image/png. Content-Type declares the body format; Accept negotiates it; charset (usually UTF-8) belongs in the Content-Type header.
Version control: a commit is an immutable snapshot identified by a hash; branches are movable pointers; merge creates a commit with two parents; rebase rewrites commits onto a new base and changes hashes.
REST constraints: client-server separation, statelessness, cacheability, uniform interface, layered system, optional code-on-demand. Resources are addressed by URIs and manipulated through representations.
DNS resolves a hostname to an IP address; TCP then establishes a connection; TLS adds encryption and identity. HTTPS defaults to port 443, HTTP to port 80, and the same-origin policy compares scheme, host, and port.
Semantic versioning MAJOR.MINOR.PATCH: MAJOR for incompatible API changes, MINOR for backward-compatible features, PATCH for backward-compatible fixes. A caret range (^1.2.3) allows MINOR and PATCH updates; a tilde (~1.2.3) allows PATCH only.
Build tooling roles: bundlers (webpack, esbuild, Vite) resolve and combine modules; transpilers (Babel, TypeScript) convert syntax; linters (ESLint) detect code issues; minifiers reduce size; source maps map output back to original sources.
HTML Document Markup
Document skeleton: first, then a single root containing (metadata) and (rendered content). The element is required in practice and supplies the browser tab and search-result text.</p>
Void (self-closing) elements have no end tag and cannot contain content: area, base, br, col, embed, hr, img, input, link, meta, param, source, track, wbr.
Heading elements
through express outline depth, not font size. Exactly one per page is the common convention; skipping levels breaks the document outline.Semantic landmarks:
, , (one per document), (thematic, usually with a heading), (self-contained), (tangential), . and are generic containers with no semantics.Lists:
- unordered,
- may be a direct child of
- or
- .
- ordered (with start, reversed, type attributes), description list pairing terms with descriptions. Only
- may be a direct child of
Forms:
; controls (text, email, password, checkbox, radio, file, hidden, submit, number, date),Table structure:
containing , , , , , then rows
of / . The scope attribute on declares row or column association for assistive technology. Global attributes: id (unique in the document), class (space-separated tokens), style, title, lang, dir, hidden, tabindex, data-* (custom data read via dataset), contenteditable, and ARIA attributes such as role and aria-label.
Embedding and media: requires alt (empty alt for decorative images); with enables art direction; / use and controls; embeds another browsing context and should carry a title.
CSS Content Styling
Cascade order (low to high precedence): user-agent styles, user styles, author styles, author !important, user !important. Within the same origin, specificity decides; then source order breaks ties.
Specificity as a four-part tuple (inline, IDs, classes/attributes/pseudo-classes, elements/pseudo-elements). (0,1,0,0) beats (0,0,5,3); :where() contributes zero specificity, :is() and :not() take the specificity of their most specific argument.
Box model: content, padding, border, margin. box-sizing: content-box adds padding and border outside width; border-box includes them, so width equals the visible box.
Display values: block, inline, inline-block, flex, grid, none. display:none removes the element from layout and the accessibility tree; visibility:hidden keeps the space but hides the box.
Flexbox: the container sets display:flex, flex-direction, justify-content (main axis), align-items (cross axis), gap, flex-wrap. Items use flex-grow, flex-shrink, flex-basis (shorthand flex).
Grid: display:grid with grid-template-columns/rows, fr units, repeat(), minmax(), auto-fit/auto-fill; placement via grid-column and grid-row (line numbers or spans); gap sets gutters.
Positioning: static (default), relative (offset from normal position, keeps space), absolute (removed from flow, positioned against nearest positioned ancestor), fixed (viewport), sticky (relative until a scroll threshold).
Responsive design: the viewport meta tag, fluid units (%, rem, vw/vh), and media queries such as @media (min-width: 768px). Mobile-first means base styles for small screens and min-width queries to enhance upward.
Custom properties (--name) are inherited and read with var(--name, fallback); they are resolved at computed-value time, which enables theming and runtime changes from JavaScript via style.setProperty.
JavaScript Programming
Declarations: var is function-scoped and hoisted as undefined; let and const are block-scoped and sit in the temporal dead zone until initialized. const prevents rebinding, not mutation of the referenced object.
Types: primitives (string, number, bigint, boolean, undefined, null, symbol) plus objects. typeof null returns "object"; NaN is a number and NaN !== NaN; use Number.isNaN or Object.is for reliable checks.
Equality: == applies type coercion, === does not. Falsy values are false, 0, -0, 0n, "", null, undefined, NaN; everything else, including [] and {}, is truthy.
Functions: declarations hoist fully; function expressions and arrow functions do not. Arrows have no own this, arguments, or new.target, so they inherit this lexically and cannot be constructors.
Scope and this: this in a normal function call is undefined in strict mode and the global object otherwise; as a method it is the receiver; call/apply/bind set it explicitly. Closures capture the enclosing lexical environment.
Arrays: map, filter, reduce, forEach, find, some, every, slice (non-mutating) versus splice (mutating), push/pop (end) versus shift/unshift (start), and spread [...] for shallow copies.
Asynchronous JavaScript: the event loop drains the call stack, then microtasks (promise callbacks, queueMicrotask), then macrotasks (timers, I/O). async functions return promises; await pauses inside the async function only.
Promises have three states: pending, fulfilled, rejected, and are settled once. Promise.all rejects on the first rejection; Promise.allSettled waits for all; Promise.race settles with the first result.
Modules and DOM: ES modules use import/export, are deferred, strict by default, and have their own top-level scope. DOM selection uses querySelector/querySelectorAll; events propagate through capture, target, and bubble phases, and addEventListener options include capture, once, and passive.
NodeJS Server Programming
Node is a single-threaded event loop running JavaScript on V8 with non-blocking I/O delegated to libuv's thread pool. Blocking the loop with synchronous CPU work stalls every concurrent request.
Event loop phases in order: timers, pending callbacks, idle/prepare, poll, check (setImmediate), close callbacks; process.nextTick and promise microtasks drain between each phase.
CommonJS uses require/module.exports and is synchronous; ES modules use import/export and are enabled by "type": "module" in package.json or the .mjs extension. package.json holds name, version, main/exports, scripts, and dependencies.
Core modules: fs (readFile/writeFile async, readFileSync blocking), path (join, resolve, dirname, extname), http (createServer), os, url, crypto, events (EventEmitter with on/emit), stream, and process (argv, env, exit).
Error-first callbacks take (err, data); promises and async/await are preferred for sequencing. Unhandled rejections and uncaught exceptions terminate the process by default, so wrap awaited work in try/catch.
A minimal HTTP server: http.createServer((req, res) => {...}) then server.listen(port, callback). req.method and req.url identify the request; res.writeHead(status, headers) and res.end(body) send the response.
Express: app.get/post/use define routes and middleware; middleware signature (req, res, next) runs in registration order; next(err) forwards to error-handling middleware with four arguments (err, req, res, next).
Environment configuration: read secrets and ports from process.env (populated by dotenv or the platform), never hard-code them. NODE_ENV=production commonly disables development logging and enables caching.
npm essentials: npm init, npm install (--save-dev for tooling), package-lock.json pins the resolved dependency tree, and the scripts block exposes commands run with npm run .
Software Development and Web Technologies
The HTTP request/response cycle: client sends method, path, headers, optional body; server returns status code, headers, body. Stateless by design, so state is carried by cookies, tokens, or server-side sessions.
Status code classes: 1xx informational, 2xx success (200 OK, 201 Created, 204 No Content), 3xx redirection (301 permanent, 302/307 temporary, 304 Not Modified), 4xx client error (400, 401 unauthenticated, 403 forbidden, 404, 405, 409, 422, 429), 5xx server error (500, 502, 503, 504).
Idempotent methods: GET, HEAD, PUT, DELETE, OPTIONS are idempotent; POST is not. Safe methods (no state change): GET, HEAD, OPTIONS. PUT replaces a full resource; PATCH applies a partial modification.
MIME types drive interpretation: text/html, text/css, application/javascript, application/json, image/png. Content-Type declares the body format; Accept negotiates it; charset (usually UTF-8) belongs in the Content-Type header.
Version control: a commit is an immutable snapshot identified by a hash; branches are movable pointers; merge creates a commit with two parents; rebase rewrites commits onto a new base and changes hashes.
REST constraints: client-server separation, statelessness, cacheability, uniform interface, layered system, optional code-on-demand. Resources are addressed by URIs and manipulated through representations.
DNS resolves a hostname to an IP address; TCP then establishes a connection; TLS adds encryption and identity. HTTPS defaults to port 443, HTTP to port 80, and the same-origin policy compares scheme, host, and port.
Semantic versioning MAJOR.MINOR.PATCH: MAJOR for incompatible API changes, MINOR for backward-compatible features, PATCH for backward-compatible fixes. A caret range (^1.2.3) allows MINOR and PATCH updates; a tilde (~1.2.3) allows PATCH only.
Build tooling roles: bundlers (webpack, esbuild, Vite) resolve and combine modules; transpilers (Babel, TypeScript) convert syntax; linters (ESLint) detect code issues; minifiers reduce size; source maps map output back to original sources.
HTML Document Markup
Document skeleton: first, then a single root containing (metadata) and (rendered content). The element is required in practice and supplies the browser tab and search-result text.</p>
Void (self-closing) elements have no end tag and cannot contain content: area, base, br, col, embed, hr, img, input, link, meta, param, source, track, wbr.
Heading elements
through express outline depth, not font size. Exactly one per page is the common convention; skipping levels breaks the document outline.Semantic landmarks:
, , (one per document), (thematic, usually with a heading), (self-contained), (tangential), . and are generic containers with no semantics.Lists:
- unordered,
- may be a direct child of
- or
- .
- ordered (with start, reversed, type attributes), description list pairing terms with descriptions. Only
- may be a direct child of
Forms:
; controls (text, email, password, checkbox, radio, file, hidden, submit, number, date),Table structure:
containing , , , , , then rows
of / . The scope attribute on declares row or column association for assistive technology. Global attributes: id (unique in the document), class (space-separated tokens), style, title, lang, dir, hidden, tabindex, data-* (custom data read via dataset), contenteditable, and ARIA attributes such as role and aria-label.
Embedding and media: requires alt (empty alt for decorative images); with enables art direction; / use and controls; embeds another browsing context and should carry a title.
CSS Content Styling
Cascade order (low to high precedence): user-agent styles, user styles, author styles, author !important, user !important. Within the same origin, specificity decides; then source order breaks ties.
Specificity as a four-part tuple (inline, IDs, classes/attributes/pseudo-classes, elements/pseudo-elements). (0,1,0,0) beats (0,0,5,3); :where() contributes zero specificity, :is() and :not() take the specificity of their most specific argument.
Box model: content, padding, border, margin. box-sizing: content-box adds padding and border outside width; border-box includes them, so width equals the visible box.
Display values: block, inline, inline-block, flex, grid, none. display:none removes the element from layout and the accessibility tree; visibility:hidden keeps the space but hides the box.
Flexbox: the container sets display:flex, flex-direction, justify-content (main axis), align-items (cross axis), gap, flex-wrap. Items use flex-grow, flex-shrink, flex-basis (shorthand flex).
Grid: display:grid with grid-template-columns/rows, fr units, repeat(), minmax(), auto-fit/auto-fill; placement via grid-column and grid-row (line numbers or spans); gap sets gutters.
Positioning: static (default), relative (offset from normal position, keeps space), absolute (removed from flow, positioned against nearest positioned ancestor), fixed (viewport), sticky (relative until a scroll threshold).
Responsive design: the viewport meta tag, fluid units (%, rem, vw/vh), and media queries such as @media (min-width: 768px). Mobile-first means base styles for small screens and min-width queries to enhance upward.
Custom properties (--name) are inherited and read with var(--name, fallback); they are resolved at computed-value time, which enables theming and runtime changes from JavaScript via style.setProperty.
JavaScript Programming
Declarations: var is function-scoped and hoisted as undefined; let and const are block-scoped and sit in the temporal dead zone until initialized. const prevents rebinding, not mutation of the referenced object.
Types: primitives (string, number, bigint, boolean, undefined, null, symbol) plus objects. typeof null returns "object"; NaN is a number and NaN !== NaN; use Number.isNaN or Object.is for reliable checks.
Equality: == applies type coercion, === does not. Falsy values are false, 0, -0, 0n, "", null, undefined, NaN; everything else, including [] and {}, is truthy.
Functions: declarations hoist fully; function expressions and arrow functions do not. Arrows have no own this, arguments, or new.target, so they inherit this lexically and cannot be constructors.
Scope and this: this in a normal function call is undefined in strict mode and the global object otherwise; as a method it is the receiver; call/apply/bind set it explicitly. Closures capture the enclosing lexical environment.
Arrays: map, filter, reduce, forEach, find, some, every, slice (non-mutating) versus splice (mutating), push/pop (end) versus shift/unshift (start), and spread [...] for shallow copies.
Asynchronous JavaScript: the event loop drains the call stack, then microtasks (promise callbacks, queueMicrotask), then macrotasks (timers, I/O). async functions return promises; await pauses inside the async function only.
Promises have three states: pending, fulfilled, rejected, and are settled once. Promise.all rejects on the first rejection; Promise.allSettled waits for all; Promise.race settles with the first result.
Modules and DOM: ES modules use import/export, are deferred, strict by default, and have their own top-level scope. DOM selection uses querySelector/querySelectorAll; events propagate through capture, target, and bubble phases, and addEventListener options include capture, once, and passive.
NodeJS Server Programming
Node is a single-threaded event loop running JavaScript on V8 with non-blocking I/O delegated to libuv's thread pool. Blocking the loop with synchronous CPU work stalls every concurrent request.
Event loop phases in order: timers, pending callbacks, idle/prepare, poll, check (setImmediate), close callbacks; process.nextTick and promise microtasks drain between each phase.
CommonJS uses require/module.exports and is synchronous; ES modules use import/export and are enabled by "type": "module" in package.json or the .mjs extension. package.json holds name, version, main/exports, scripts, and dependencies.
Core modules: fs (readFile/writeFile async, readFileSync blocking), path (join, resolve, dirname, extname), http (createServer), os, url, crypto, events (EventEmitter with on/emit), stream, and process (argv, env, exit).
Error-first callbacks take (err, data); promises and async/await are preferred for sequencing. Unhandled rejections and uncaught exceptions terminate the process by default, so wrap awaited work in try/catch.
A minimal HTTP server: http.createServer((req, res) => {...}) then server.listen(port, callback). req.method and req.url identify the request; res.writeHead(status, headers) and res.end(body) send the response.
Express: app.get/post/use define routes and middleware; middleware signature (req, res, next) runs in registration order; next(err) forwards to error-handling middleware with four arguments (err, req, res, next).
Environment configuration: read secrets and ports from process.env (populated by dotenv or the platform), never hard-code them. NODE_ENV=production commonly disables development logging and enables caching.
npm essentials: npm init, npm install (--save-dev for tooling), package-lock.json pins the resolved dependency tree, and the scripts block exposes commands run with npm run .