JavaScript
JavaScript · Browse articles by tag (only tags with 5+ articles get a page).
Essential JavaScript Array Methods
Split the array API into methods that mutate and methods that return a new array, then use map, filter, reduce, find and some correctly, including sort's string default.
JavaScript Async and Promises
Why 1 4 3 2 is the correct order, promise states and chaining, async/await error handling, serial versus parallel work, the four combinators, and concurrency limits.
JavaScript Practice: a Frontend App Without a Framework
A reading list in plain JavaScript: one state object plus a render function, event delegation, localStorage with validation and migration, form errors, and keyboard access.
JavaScript Practice: a Node.js CLI Tool
Build linkscan: parse arguments with parseArgs, walk Markdown files, probe external links with bounded concurrency, print machine-readable output, and return real exit codes.
JavaScript Conditionals and Loops
Pick between if, switch, for, for...of and while with intent, and avoid the iteration bugs: fall-through cases, for...in on arrays, and break inside forEach.
JavaScript DOM and Events
Selecting and creating nodes, batching updates, capture and bubble, event delegation, listener cleanup with AbortSignal, form handling, and the XSS risk in innerHTML.
JavaScript Error Handling
What an Error carries, when to throw, how try/catch/finally runs, custom error classes with instanceof, the cause option, and why async errors escape try/catch.
JavaScript fetch and HTTP in Practice
fetch does not reject on 404, a body can be read once, timeouts need AbortSignal, retries need backoff, and browsers add CORS on top of all of it.
JavaScript Functions, Scope and Closures
Compare declarations, expressions and arrow functions, use default and rest parameters, and understand scope chains, closures, and the classic var-in-a-loop trap.
JavaScript Modules: ESM and CommonJS
Named and default exports, live bindings, dynamic import, the CommonJS snapshot trap, interop rules in Node, the exports map, and how to break a cycle.
JavaScript Objects and Destructuring
Object literals, property access and iteration, destructuring with renames and defaults, and why spreading gives you a shallow copy that still shares nested objects.
JavaScript Operators and Type Coercion
Why == surprises you, which eight values are falsy, how + and - coerce differently, and when to reach for ??, ?. and Number.isNaN().
JavaScript Strings and Template Literals
Template literal interpolation, string immutability, UTF-16 length surprises, slice versus substring, and why replace() only changes the first match.
Testing JavaScript with Vitest
Set up Vitest, pick the right assertion, test async code with fake timers, replace dependencies with vi.fn and vi.mock, and enforce coverage in CI.
JavaScript Tooling: npm, Vite and Linting
package.json fields that matter, lockfiles and npm ci, script conventions, Vite dev versus build, why VITE_ variables are public, and ESLint versus Prettier.
JavaScript Variables: var, let and const
How var, let and const differ in scope, hoisting and rebinding, what the temporal dead zone protects you from, and why typeof null returns "object".