formatRange Renders Number Ranges
formatRange renders two numbers as one localized range with collapsed units and percents, instead of concatenating two separately formatted values.
Page 3 of 9
formatRange renders two numbers as one localized range with collapsed units and percents, instead of concatenating two separately formatted values.
roundingPriority picks between fraction and significant digit limits, roundingMode picks the direction, and trailingZeroDisplay trims whole numbers only.
Checking process.stdout.isTTY before styling keeps piped and redirected output clean, which is what every CLI does before it emits ANSI colors.
JSON.rawJSON embeds the exact digit text into JSON output, keeping 9007199254740993 and 1.00 intact where regular numbers round and normalize.
Reading layout after every style write forces synchronous reflow; collect all offsetHeight reads first, then apply writes so the browser lays out once.
map passes (element, index, array) to callbacks, so parseInt treats the index as a radix and returns NaN; wrap it or call Number instead.
Math.fround rounds a double to the nearest float32 value kept as a double: 1.1 drifts, 1.5 survives, integers past 2^24 and huge magnitudes clamp.
Math.hypot sums squares without the intermediate overflow that a hand-written sqrt(x*x + y*y) hits for large components.
Math.imul performs real 32-bit integer multiplication with wrap-around, where plain * continues in double precision and silently loses low bits.
Math.max and Math.min with an empty spread return -Infinity and Infinity, and a single NaN poisons the whole aggregate.
mouseover and mouseout bubble up from children, so moving inside a container re-fires it; mouseenter and mouseleave fire only on real boundary crossings.
Underscore separators group digits inside numeric literals — decimal, binary, and floats included — without changing the value they denote.
Object.keys sorts integer-like keys ascending before insertion-ordered string keys, while Map keeps pure insertion order — prefix numbered keys to opt out.
os.hostname, freemem, totalmem, uptime, loadavg, and availableParallelism read the running machine, with loadavg documented as zero on Windows.
The path.posix namespace applies forward-slash rules on every OS, keeping join, normalize, and relative output identical across contributor machines.
PerformanceObserver collects mark and measure entries through a callback with entryTypes filtering, so timing data arrives instead of being polled manually.
event.preventDefault cancels the default action while other listeners still run; stopPropagation blocks other listeners while the default action proceeds.
The in operator with a private field tests the slot itself, so structural branding passes for class instances and fakes with matching public shapes fail.
Positive and negative lookbehind anchor matches to preceding text without including it, so key prefixes and price signs stay out of captured values.
A rest parameter gathers trailing arguments into a real array, replacing arguments; the spread call syntax and destructuring rest feed the same mechanism.
follower.scrollTop = driver.scrollTop keeps two panes aligned; scrollHeight minus clientHeight is the maximum reachable offset.
stepUp and stepDown move a number input by its step attribute and clamp at min and max, keeping the value valid without manual math.
Sign payloads with a non-extractable HMAC key from the WebCrypto API and verify with subtle.verify, so secrets never need byte-by-byte comparison.
super() must run before this exists in a subclass constructor, and super.method() reaches the parent implementation from an override.
toggleAttribute flips boolean attributes with an optional force argument, unlike setAttribute which always writes a string value.
pipeThrough slots a TransformStream between readable and writable so each chunk passes through transform while backpressure flows down the whole chain.
new URL resolves relative references against a base: plain segments replace the tail, .. climbs, and a leading slash restarts from the root.
new URL splits scheme, host, port, path, and hash without string surgery, while searchParams.get, set, and append keep every mutation URL-safe.
Each input.validity flag mirrors one HTML5 rule — typeMismatch, valueMissing, rangeUnderflow — so messages can target the exact failed check.
yield* delegates iteration to another generator, forwarding next() calls and handing its return value back to the outer generator.
Wait for animationend instead of guessing durations, then remove the element with removeEventListener so CSS drives timing and JS only reacts.
Assert sync throws with assert.throws and async rejections with assert.rejects, matching error classes and message patterns exactly.
Buffer.alloc zero-fills every byte while allocUnsafe reuses pooled memory, so uninitialized bytes must be overwritten before leaving your code.
Measure the wire size of strings and buffers with Buffer.byteLength, because .length counts UTF-16 code units and diverges for CJK and emoji.
Adapt promise-returning functions to the classic Node error-first callback shape with util.callbackify, rejections included.
Strip the smallest common leading indent from multi-line template text so nested call sites still produce flush, presentable output.
Parse untrusted HTML strings with DOMParser into a detached document where scripts never run and images never load, then extract safe text.
Register a process exit handler that synchronously flushes pending writes, because async work started inside exit handlers cannot finish.
Listen once on a container because focusin and focusout bubble, so fields added later are tracked without rebinding per-element listeners.
Remove whole scratch directories with fs.rm recursive, and let force turn missing paths into no-ops so cleanup code is safe to run twice.
List active CSS transitions with getAnimations and await their finished promises instead of hardcoding durations; snapshot after the new style has rendered.
Load node builtins synchronously inside a function with process.getBuiltinModule, so request paths skip top-level await and import hoisting.
Wrap text greedily so each line takes as many words as fit the width, keeping every returned line within the limit for terminal output.
Map location.hash to view state with a hashchange listener so every tab change is a shareable URL and back navigation rewinds the view.
Listen for the image error event and swap in a fallback source exactly once, so a broken avatar never survives a failed request.
Read process.memoryUsage around a workload and correlate rss, heapUsed, and heapTotal deltas so leaks show up as deltas, not folklore.
Order callbacks across nextTick, promise microtasks, and timers so a ready signal fires before anything asynchronous can interleave.
Mark wheel and touch listeners as passive so the browser scrolls immediately without waiting for preventDefault decisions in handlers.
Read pasted clipboard text from clipboardData, normalize it, and reject values that fail the input's expected shape before they land.
Read named radio groups via form.elements and RadioNodeList.value, and clear the group by unchecking each input: assigning '' is not a reset.
Choose manual or auto scroll restoration per route so long lists do not jump back to the top on reload or on back navigation.
Compare scrollWidth with clientWidth to detect hidden content overflow, and read the offsetWidth gap that a scrollbar leaves behind.
Read chosen items from a multi-select through selectedOptions so form payloads keep every picked value without scanning all option elements.
Queue analytics with navigator.sendBeacon on pagehide, where fetch can be cancelled mid-unload and the payload would be lost.
Express asymmetric difference and symmetric difference with Set operations so changed keys and both-sided drift fall out of the comparison.
Register setImmediate from inside an I/O callback so the check phase runs right after poll — before the timers phase of the next loop iteration.
Share one symbol across modules through the Symbol.for registry, so hidden metadata keys match even when modules load separately.
Decode byte chunks with streaming: true so multi-byte characters split across reads survive, and final flush drops nothing at the boundary.
Show that a throw inside setTimeout never reaches the surrounding try catch, and route it to an uncaughtException handler instead.
Read <input type="date"> through valueAsDate to get a UTC-midnight Date object, because the raw .value string has no timezone at all.
Track which objects a traversal has touched with WeakSet — members can be garbage collected, so the bookkeeping never pins the graph in memory.
constructable CSSStyleSheet objects are adopted by document and shadow roots at once, so replaceSync updates and un-adoption apply everywhere simultaneously.
Promise.any settles with the first success; when every attempt rejects it throws AggregateError carrying each member error for inspection.
Array.prototype.entries yields index-and-value pairs for for-of, .keys and .values give each half alone, and sparse arrays report holes as undefined.
Iterate arrays as [index, value] pairs with entries(), take keys() or values() alone, and stop early because the trio returns real iterators.
Array.from converts array-likes, iterables, and strings, and its mapFn argument builds transformed arrays in one pass without intermediate copies.
async functions always return promises: a throw before any await becomes a rejected promise, while plain functions raise synchronous errors.
Propagate per-request data through deep awaits with AsyncLocalStorage: each requestContext.run gets an isolated store reachable anywhere inside.
attachShadow scopes markup and queries inside a shadow root and keeps its styles from leaking out; closed mode additionally hides the shadowRoot reference.
await using calls Symbol.asyncDispose when the block exits and awaits the cleanup, so locks and handles release even when the work in between throws.
Computed property keys turn variables and expressions into literal keys, building index tables and reading names that dot syntax cannot express.
decodeURIComponent throws URIError on bare percent signs, truncated escapes, and invalid hex, so decode user-controlled values inside a catching boundary.
details and summary give a native disclosure widget whose open property is both state and API, and the toggle event reports each open/close transition.
before, after, replaceWith, and remove edit the tree around a node directly: insertions anchor to siblings and removal needs no parent reference.
generator .next(value) passes input into the paused yield expression, and the generator's return value surfaces as the final done result object.
the hidden attribute stops rendering and focus while the element stays in the DOM; a stronger author display rule can defeat it until [hidden] restores it.
input fires on every value mutation while change waits for a commit; dispatching both shows which handler updates UI live versus on blur.
JSON.stringify throws TypeError on BigInt values, so big ids need string encoding, a toJSON method, or a replacer that converts every bigint at once.
Gate window messages by event.origin before touching data: unmatched senders are dropped and payload shape is verified independently.
wrapping Promise.all jobs so the first rejection aborts a shared signal stops sibling tasks mid-flight instead of letting them finish into an unread result.
A promise locks its state on the first resolve or reject; every later settle call is a no-op, while extra then observers still see the settled value.
replace with a callback builds substitutions from the match and its capture groups, and returns them literally where $ sequences would have expanded.
Subclasses of Array control what slice and map return through Symbol.species: default keeps the subclass, override restores plain Array.
TypedArray.set copies source data into an optional offset, converts across element widths with wrapping, and never shares memory with the source.
WeakSet records which objects a traversal has handled without pinning them in memory, rejects primitives, and exposes no size or iteration surface.
Compare parsed data against expected structures with assert.deepStrictEqual, where object key order is ignored but array order matters.
Feed chunks into createHash with repeated update calls and compare the digest against a one-shot hash to prove hashing is incremental.
Draw bounded integers with crypto.randomInt, where the upper bound is exclusive, avoiding the modulo bias that hand-rolled Math.random tricks introduce.
Probe existence and read or write permission with fs.access and its F_OK, R_OK, and W_OK constants, catching ENOENT for missing paths.
Copy a directory tree with fs.cp using recursive and filter options, skipping scratch files while preserving the nested folder structure.
Match nested files with fs.glob patterns, where one star stays inside a single path segment, two stars cross directories, and classes narrow matches.
List a directory with withFileTypes to receive Dirent objects, classifying files and folders by name without extra stat calls per entry.
Publish new content with fs.rename so the destination is replaced in one filesystem operation and readers never observe a half-written file.
Read a path's size, timestamps, and entry kind with fs.stat, distinguishing files from directories before acting on the metadata.
Compare Map and plain-object lookup semantics: object keys stringify, Map keys keep identity, and size plus delete behave predictably for dynamic data.
Compose and decompose filesystem paths with join, resolve, basename, extname, and dirname so path logic never relies on string concatenation.
Stretch a password into a 256-bit key with WebCrypto PBKDF2 using a fixed salt and 100000 iterations, then render the derived bits as hex.
Read environment variables with string-aware defaults: coalesce missing vars, coerce numbers explicitly, and parse flag or list values safely.
Set process.exitCode instead of calling process.exit so buffered output drains first, and summarize batch checks into one exit status for shell scripts.
Validate names against suffix and prefix rules with endsWith and startsWith, handling extension allowlists and reserved-name prefixes.