The reading room
Articles and practical guides.
Practical guides to JavaScript, Node.js, web development, files, browser troubleshooting, and social data.
203 guides · Examples, explanations, and practical limits.
Browse by topic
JavaScript
Small, reproducible recipes for arrays, objects, strings, asynchronous work, and common language mistakes.
Node.js
File processing, command-line scripts, streams, and server fundamentals using built-in Node.js modules.
Web development
Accessible HTML, responsive CSS, HTTP, and the mechanics of publishing a usable static website.
Files and data
Practical ways to inspect, validate, transform, and compare text, JSON, CSV, and binary data.
Browser troubleshooting
Understand browser memory, local storage, downloads, permissions, and network failures before changing settings.
Social data
Understand account exports and follower comparisons, with worked examples and limits on what the data can prove.
Snowcone
Queues, stacks, and line-by-line file reading.
All articles
203 articles
Remove duplicate values from a JavaScript array
Wrap an array in a Set and spread it into a new array to remove repeated primitive values while keeping the order of their first appearance.
Deduplicate objects by ID with a JavaScript Map
Use a Map keyed by a stable identifier to keep one record per ID. Reassigning an existing key replaces its value without moving that key to a new insertion position.
Sort numbers correctly in JavaScript
Pass a numeric comparator to Array.sort. Without one, JavaScript compares string representations, so 10 can appear before 2. Copy the array first when callers need…
Sort an array without changing the original
Use toSorted to return a sorted copy of an array. It expresses the nonmutating operation directly and is useful when several parts of a program share the same array.
Sort human-readable text with Intl.Collator
Use Intl.Collator when sorting names or filenames for people. A chosen locale and options make the intended text ordering clearer than relying on Unicode code-point…
Remove null and undefined without dropping zero
Use an explicit nullish predicate when filtering values. Boolean filtering also removes zero, false, and empty strings, which may be legitimate data rather than…
Find one object by property in an array
Use Array.find when you want the first record matching a condition. It returns the record itself, or undefined if no element matches; it does not return an array of…
Choose between Array.some and Array.every
Use some to ask whether at least one entry passes a test, and every to ask whether all entries pass. Both stop once their answer is determined.
Flatten one level of nested arrays
Call flat with depth 1 to combine one level of nested arrays into a new array. Deeper arrays remain nested, which helps preserve meaningful grouping further down the…
Map and flatten records with flatMap
Use flatMap when one input entry should produce zero, one, or several output entries. Return an empty array to omit an entry and a short array to expand it.
Sum values with reduce and an initial value
Supply an initial accumulator when using reduce to sum values. An initial zero makes the empty-array result well defined and keeps the accumulator type predictable.
Copy an object with spread syntax
Object spread creates a new object from another object’s enumerable own properties. It is useful for changing a few top-level fields while retaining the remaining values.
Deep-clone supported data with structuredClone
Use structuredClone to copy supported structured data, including nested objects and cyclic references. It is a better fit than JSON round-tripping when you need…
Read optional nested values safely
Optional chaining stops a property access when the value immediately to its left is null or undefined. It helps read partially populated records without nested…
Use nullish coalescing for defaults
Use the nullish coalescing operator when a default should apply only to null or undefined. Unlike logical OR, it preserves intentional values such as zero, false, and…
Transform object values with entries and fromEntries
Convert an object into entries, transform the key-value pairs, then rebuild it with Object.fromEntries. This is useful for explicit transformations of a flat…
Check whether an object owns a property
Use Object.hasOwn to distinguish a property stored directly on an object from one inherited through its prototype. It also works when the object has no prototype.
Group records with Object.groupBy
Object.groupBy collects iterable values into arrays under keys returned by a callback. Use it when a report needs one group per status or another simple category.
Destructure object properties with defaults
Destructuring can name local variables and supply defaults for undefined properties. Use it to make a small set of expected options visible at the start of a function.
Validate an integer string before converting it
For a complete integer field, validate the whole string and then check Number.isSafeInteger. ParseInt alone accepts a valid numeric prefix and can hide trailing…
Check for NaN without coercion
Use Number.isNaN when you want to know whether a value is specifically the numeric NaN value. It does not coerce arbitrary strings or objects into numbers first.
Format decimal numbers for display
Use toFixed when you need a fixed number of decimal places in display text. It returns a string and should not be mistaken for a change to the precision of the stored…
Format currency with Intl.NumberFormat
Use Intl.NumberFormat with an explicit locale and currency to display monetary amounts. The formatter chooses currency symbols, separators, and default fraction…
Trim whitespace from the edges of a string
Use trim to remove leading and trailing whitespace while preserving whitespace inside a string. This is a common first step for text input, but it should follow the…
Replace every literal substring
Use replaceAll with a string search value when every literal occurrence should be replaced. It avoids constructing a regular expression for input that is meant to be…
Split a small text string into lines
For a small in-memory text value, split on a line-ending expression that recognizes CRLF, LF, and CR. Keep or remove a trailing empty line according to the file…
Normalize Unicode text before comparison
Normalize strings to a chosen Unicode normalization form before comparing visually equivalent text. NFC combines supported character sequences into their canonical…
Count grapheme clusters in a string
Use Intl.Segmenter with grapheme granularity when counting user-perceived text units. String.length counts UTF-16 code units, which can split emoji and…
Escape a literal value for a regular expression
Use RegExp.escape when a dynamic string must be matched literally inside a regular expression. It protects punctuation from becoming pattern syntax and handles edge…
Convert a valid Date to an ISO timestamp
Use toISOString to serialize a valid Date as a UTC timestamp. Check that the date is valid first when the value comes from an external source.
Display a date in an explicit time zone
Use Intl.DateTimeFormat with a timeZone option when a timestamp should be shown in a particular region. Otherwise the environment’s default zone can change the…
Compare two timestamps by their numeric time
Compare Date.getTime values when checking the order of actual instants. The numeric result is milliseconds since the epoch, independent of how the date is displayed.
Run independent asynchronous tasks with Promise.all
Use Promise.all to await independent tasks together and receive results in input order. It rejects when an input promise rejects, even if other tasks are still running.
Collect successes and failures with Promise.allSettled
Use Promise.allSettled when every task outcome matters, including failures. It waits for all inputs and returns a status record for each one in input order.
Await work sequentially with for...of
Use a for...of loop with await when tasks must complete one at a time. An async callback passed to forEach does not make the surrounding function wait for those…
Limit concurrent asynchronous jobs
Use a small worker pool when a list of asynchronous jobs should run concurrently without starting every job at once. Each worker takes the next available index and…
Clean up asynchronous work with finally
Use finally for cleanup that must run after an awaited operation succeeds or fails. Keep the original error visible by avoiding a return or replacement error inside…
Create an application-specific Error subclass
Subclass Error when callers need to distinguish a known application failure from unrelated exceptions. Give it a meaningful name and retain a useful message for logs…
Yield array batches with a generator
Use a generator to yield slices of an array a batch at a time. Consumers can process one batch before requesting the next instead of first constructing an array…
Check array membership with includes
Use Array.includes when you need a boolean answer about whether an array contains a value. It is clearer than comparing an index against minus one when the index…
Preserve ties when sorting records
Return zero from a comparator when two records have equal sort keys. Stable sorting preserves their previous relative order, allowing a deliberate tie rule without…
Serialize BigInt values deliberately
Convert BigInt values to decimal strings before JSON serialization. JSON.stringify does not serialize BigInt directly, and converting a large integer to Number can…
Understand what Object.freeze protects
Object.freeze prevents changes to an object’s own properties, but it does not recursively freeze nested objects. Treat it as a shallow integrity constraint rather…
Generate a casual random integer in a range
For a non-security task, use Math.random with a half-open integer range: minimum inclusive, maximum exclusive. Naming both boundaries helps avoid off-by-one errors in…
Use default function parameters predictably
Default parameters apply when an argument is omitted or explicitly undefined. They do not replace null, false, zero, or an empty string.
Read a UTF-8 text file in Node.js
Read a small text file with the promise-based readFile API and an explicit UTF-8 encoding. The resolved result is a string rather than a Buffer when an encoding is…
Write a small JSON file in Node.js
Serialize a value with JSON.stringify and write it using UTF-8. Add a final newline for a file that is easy to inspect with text tools, and read it back when checking…
Append a line to a text file
Use appendFile to add text at the end of a file, creating the file if needed. Include the line separator explicitly; the API does not insert one for you.
Create nested directories in Node.js
Use mkdir with recursive true when a script needs a directory tree that might not exist yet. Await creation before writing a file inside the final directory.
List directory entries and their types
Pass withFileTypes to readdir when you need entry names and basic type checks. The returned Dirent objects can distinguish ordinary files and directories without…
Inspect a file’s size and type
Use stat to inspect metadata such as byte size and whether a path refers to a regular file. A text file’s size is measured in bytes, not JavaScript characters.
Handle a missing file by its error code
Attempt the read and handle ENOENT when a missing file has an expected fallback. Avoid a separate existence check, because the path can change between checking and…
Create a file only when it does not already exist
Use writeFile with the wx flag to create a new file and fail if that path already exists. This expresses the exclusivity requirement in the file operation itself.
Copy a file with explicit destination behavior
Use copyFile to duplicate a regular file. Add COPYFILE_EXCL when overwriting an existing destination would be a mistake rather than the intended behavior.
Rename a file within a directory
Use rename to move a path within a filesystem. For a simple rename, build both paths explicitly and await the operation before using the destination.
Create an isolated temporary directory
Use mkdtemp with a prefix inside the operating system’s temporary directory. Keep the returned path and remove that exact directory after the operation has finished.
Read a file incrementally with readline
Combine createReadStream with readline to process a text file one line at a time. This avoids collecting the complete file into one string before processing begins.
Copy a stream with pipeline error handling
Use the promise-based pipeline helper to connect readable and writable streams. Await it so completion and stream errors reach normal async control flow.
Compress a file with a gzip stream
Insert createGzip between a readable file stream and a writable stream to compress incrementally. A pipeline coordinates backpressure and provides an awaitable…
Calculate a file’s SHA-256 digest incrementally
Feed a file stream into a SHA-256 hash when you need a content fingerprint without reading the complete file into a Buffer. Digest the hash only after all chunks have…
Join filesystem path segments portably
Use node:path join for filesystem path segments instead of manually inserting slash characters. It applies the platform’s path rules and normalizes ordinary separators.
Resolve a file relative to an ES module
Resolve a resource with new URL and import.meta.url when it belongs beside an ES module. This avoids depending on the directory from which the user launched Node.js.
Parse command-line options with util.parseArgs
Use util.parseArgs for a small command-line interface with named options. Declare option types and decide explicitly whether unexpected flags or positional arguments…
Validate numeric environment variables
Environment variables arrive as strings or undefined. Validate a complete value and its allowed range before using it as a port, timeout, or worker count.
Report CLI failure with process.exitCode
Set process.exitCode when a command should report failure after finishing normal cleanup. This lets the event loop and pending output complete instead of forcing…
Run a child command without a shell
Use execFile with an argument array when you need a child executable without shell interpolation. Keep the executable and arguments separate instead of building a…
Read child-process output as a stream
Use spawn when child output should be consumed incrementally. Attach an error listener for launch failures and observe close for the final status after standard…
Measure UTF-8 text in bytes with Buffer
Use Buffer.byteLength when a Node.js limit is expressed in encoded bytes. JavaScript string length counts UTF-16 code units and is not a reliable UTF-8 byte count.
Encode and decode Base64 with Buffer
Use Buffer to convert bytes to Base64 and back. When the original content is text, specify its encoding explicitly at both ends of the round trip.
Await a delay with timers/promises
Use the promise-based setTimeout API for an awaitable delay in Node.js. Import it under a clear name so it is not confused with the callback-based global function.
Await one EventEmitter event
Use events.once to await a single EventEmitter event. Register the wait before triggering the event so a synchronous emission cannot happen before the listener exists.
Create a readable stream from an iterable
Use Readable.from to expose an iterable as a Node.js readable stream. It is useful when a downstream API expects a stream but your producer naturally yields records.
Serve JSON from a minimal Node HTTP server
Use node:http to create a small HTTP server, set the response content type, and end the response with serialized JSON. Every request path should receive an explicit…
Check HTTP status before reading fetch JSON
Fetch does not reject just because an HTTP response has a 404 or 500 status. Check response.ok before interpreting the body as successful application data.
Give an operation a timeout signal
Use AbortSignal.timeout to create a signal that aborts after a deadline. Pass it to APIs that support cancellation rather than merely racing their promise against a…
Consume a Web ReadableStream in Node.js
A Web ReadableStream can provide chunks through async iteration in Node.js. Decode byte chunks with a streaming decoder when character sequences can cross chunk…
Move a small CPU task into a worker thread
Use a worker thread for CPU-bound JavaScript that would otherwise occupy the main event loop. A worker can receive input and return a result through messages.
Measure a code interval with performance.now
Use performance.now for elapsed-time measurements inside one process. It supplies a monotonic high-resolution time reference rather than a wall-clock timestamp…
Read Node.js process memory measurements
Use process.memoryUsage to inspect several different memory measurements. Heap usage, resident memory, and external allocations describe different parts of the…
Cancel a pending file read with AbortController
ReadFile accepts an AbortSignal so a caller can stop waiting for an unneeded read. Handle cancellation distinctly from ordinary filesystem errors when your workflow…
Give a page a semantic HTML structure
Use semantic elements to identify the main content, navigation, and surrounding page structure. These elements provide meaning independently of the visual layout…
Organize an article with meaningful headings
Use headings to describe the document’s sections. A clear page heading followed by section headings helps readers scan the article and navigate it with assistive…
Choose a link or button for an interaction
Use a link for navigation to another location and a button for an action within the current interface. Native elements provide keyboard and interaction behavior that…
Give a form input an explicit label
Associate a visible label with an input by matching the label’s for attribute to the input’s unique ID. A placeholder can supplement a label but should not replace it.
Connect validation messages to form fields
When a field has a validation error, describe the problem in text and connect that message to the field. Aria-invalid can expose its state, while aria-describedby…
Create a disclosure with details and summary
Use details and summary for a simple expandable section without writing custom toggle JavaScript. Put the control’s visible label in summary and the hidden-by-default…
Open a native modal dialog
Use dialog.showModal for a native modal dialog. Give it a meaningful heading and an obvious close action, and test focus movement as part of the interaction.
Mark up a small data table
Use a table for data with meaningful row and column relationships. Add a caption and appropriate header cells so the relationships remain understandable beyond the…
Write useful image alternative text
Choose alternative text according to the image’s role. Describe meaningful information, and use an empty alt attribute for a decorative image that adds no content to…
Serve responsive images with srcset and sizes
Use width descriptors in srcset and a matching sizes attribute to help the browser choose an image suited to the rendered slot and device pixel density.
Lazy-load images below the initial viewport
Add loading lazy to noncritical images farther down a page. Keep important initial content, such as a prominent first image, immediately discoverable and reserve…
Set a useful viewport for responsive pages
Include a viewport meta tag so mobile browsers lay out a responsive page using the device width. Pair it with flexible CSS rather than fixed desktop-width containers.
Find the element causing horizontal overflow
Investigate oversized content before hiding horizontal overflow on the whole page. Common causes include fixed widths, long code lines, large images, and grid…
Build a responsive card grid
Use CSS Grid with auto-fit and minmax to arrange cards according to the available width. Let the grid collapse naturally instead of requiring a separate breakpoint…
Let long content shrink inside a flex row
Give a flexible text child min-width zero when its intrinsic minimum size prevents a flex row from shrinking. Add an explicit wrapping policy for unusually long tokens.
Make a sidebar sticky within its layout
Use position sticky with a top offset for a sidebar that follows scrolling within its containing layout. Unlike fixed positioning, it remains tied to its normal…
Use border-box to simplify width calculations
Use box-sizing border-box when declared widths should include padding and borders. This makes percentage-width fields and constrained panels easier to reason about.
Scale a heading with CSS clamp
Use clamp to give a heading a fluid preferred size bounded by readable minimum and maximum sizes. Combine relative units so the design can respond to both viewport…
Keep a visible keyboard focus indicator
Use focus-visible to provide a clear focus indicator for keyboard interaction. Preserve a usable native focus state rather than removing outlines without a replacement.
Respect a reduced-motion preference
Use prefers-reduced-motion to reduce nonessential motion for people who request it. Apply the change to the actual moving components instead of assuming a single…
Communicate status with text as well as color
Present status using meaningful text as well as visual color. A label such as Failed or Complete remains useful when color differences are hard to perceive or styles…
Add a skip link to repeated navigation
Put a skip link near the start of the document so keyboard users can move past repeated navigation to the main content. Keep the link visible when it receives focus.
Declare the page’s language
Set lang on the root HTML element to identify the page’s primary language. Mark a passage with its own language when it differs meaningfully from the surrounding text.
Mark up a date with the time element
Use time with a datetime attribute to pair a readable date with a machine-readable value. Choose a date-only value or an offset-bearing timestamp according to what…
Use a download link for a same-origin file
Use the download attribute to suggest saving a same-origin resource with a chosen filename. It is a browser hint and does not override every server header or…
Make new-tab links explicit
When a link genuinely needs a new tab, use target blank and an explicit noopener relationship. Let the link text indicate the external destination so readers can…
Submit a simple search form with GET
Use a GET form when submitting a shareable query that retrieves information without changing server state. Named controls become query parameters in the destination URL.
Understand what robots.txt controls
Robots.txt gives cooperating crawlers rules about requesting paths. It is not an access-control system and does not reliably remove a URL from search results by itself.
Declare a canonical URL consistently
A canonical link identifies the preferred URL for a page or a set of substantially duplicate pages. Use a consistent absolute URL that matches your internal links and…
Write a useful meta description
Write a short, accurate description of what a page helps the reader do. Give each article a description suited to its actual contents rather than repeating a…
Create a small XML sitemap
List preferred public URLs in an XML sitemap to help crawlers discover them. Include an accurate modification date only when it represents a meaningful change to that…
Return a real 404 for a missing page
A missing page should normally return HTTP status 404, even when its body contains a friendly custom error design. A page that looks missing but returns 200 can…
Choose cache rules for HTML and versioned assets
Use different cache policies for frequently updated HTML and content-addressed assets. HTML can require revalidation, while a uniquely versioned asset can be cached…
Understand ETag revalidation
An ETag is a validator for a particular representation of a resource. A client can send it back with If-None-Match so the server can answer 304 when the…
Fix CORS at the server boundary
A browser CORS error usually means the remote response does not grant your page permission to read it. Fix the server policy or use an authorized backend; changing…
Fix HTTP resources on an HTTPS page
Load a secure page’s subresources over HTTPS. An HTTP script, stylesheet, request, or embedded asset can trigger mixed-content blocking or upgrading behavior…
Serve files with the correct Content-Type
Set Content-Type to describe the bytes a response actually contains. A JavaScript or JSON URL that returns an HTML fallback can fail even though the request status is…
Choose relative links carefully on nested pages
A relative link resolves against the current document URL. On a nested static site, use root-relative paths for shared site navigation and intentional local paths for…
Keep core content usable without JavaScript
Render essential text and navigation in HTML, then add JavaScript for optional convenience. For an article directory, all article links can exist before a script adds…
Make an article easier to print
Add print-specific CSS to remove repeated navigation and preserve readable article content. Check code blocks, page breaks, and link meaning in an actual print preview.
Catch malformed JSON before using imported data
Wrap JSON.parse in a controlled error boundary when reading external text. Separate syntax failure from later schema validation so a valid JSON value is not…
Validate required fields in a JSON record
After parsing JSON, validate the fields your application actually needs. Check the container type, required properties, and permitted value ranges before starting a…
Distinguish JSON arrays, objects, and null
Use Array.isArray to recognize a JSON array and a separate null check for an object record. Typeof alone reports object for both arrays and null.
Understand missing values during JSON serialization
JSON.stringify treats undefined differently in object properties and array slots. Object properties can disappear, while array positions become null so the array’s…
Restore known date fields after parsing JSON
Dates normally serialize as ISO strings in JSON. Restore a Date only for fields whose schema defines a timestamp, and validate the resulting date before using it.
Handle a leading UTF-8 BOM in text imports
If your importer permits a leading byte-order mark, remove only the first decoded U+FEFF before JSON.parse. Do not strip that character indiscriminately from the…
Pretty-print JSON without changing its data
Parse a JSON document and stringify it with an indentation argument to improve readability. Keep the original when formatting data whose exact byte representation or…
Serialize a flat object with sorted keys
For a flat object with ordinary textual keys, sort the keys before creating a serialized view. This can make small configuration diffs easier to read without changing…
Parse newline-delimited JSON records
For small newline-delimited JSON input, parse each nonempty record line separately and attach the line number to errors. Each line is an independent JSON value,…
Keep incomplete records between stream chunks
Treat stream chunks as arbitrary pieces of data, not complete records. Keep an unfinished tail between chunks and process only records whose delimiter has actually…
Escape fields when writing CSV
Quote a CSV field when it contains a comma, quote, or line break, and double embedded quotes inside quoted fields. Joining raw values with commas cannot represent…
Parse a small quoted CSV record
A CSV parser needs to distinguish commas inside quotes from actual field separators. A small state machine can demonstrate the rule, while a maintained parser is…
Choose an explicit policy for TSV fields
For a simple tab-separated export, decide what happens when a field contains a tab or line break. Rejecting unsupported content is clearer than silently producing a…
Treat CSV formula interpretation as a separate issue
CSV quoting does not stop spreadsheet applications from interpreting a cell as a formula. When exporting untrusted text for spreadsheets, choose a consumer-specific…
Preserve leading zeros in identifiers
Keep identifiers as strings when leading zeros are meaningful. A code such as 00123 is not necessarily a quantity, and converting it to a number discards information.
Reject invalid UTF-8 instead of replacing bytes
Use TextDecoder with fatal true when invalid UTF-8 should stop an import. The default replacement behavior can hide encoding problems by substituting replacement…
Keep binary files as bytes until decoding is justified
Read binary content as bytes rather than assuming every selected file is text. Text decoding is a separate interpretation step and can replace byte sequences that are…
Base64-encode a small byte array in a browser
Btoa encodes a binary string, not arbitrary Unicode text. For a small byte array, map each byte to a code unit before encoding; encode text to UTF-8 bytes first if…
Read a binary integer with an explicit byte order
Use DataView when a binary format specifies integer widths and byte order. Pass the endianness flag deliberately instead of assuming the host machine’s native layout…
Convert a byte array to a hexadecimal string
Convert each byte to base 16 and pad it to two characters to obtain a readable hexadecimal representation. Padding preserves byte boundaries for small values.
Compare two lists of identifiers
Use sets to compute identifiers present in one list but absent from another. Label the direction explicitly, because A minus B answers a different question from B…
Compare lists while preserving duplicate counts
Count occurrences with a Map when repeated entries are meaningful. A set comparison cannot distinguish one copy of an ID from several copies of the same ID.
Count text lines with an explicit trailing-newline rule
Define whether a final newline terminates the last record or creates an additional empty record. For a common text-line convention, an empty file has zero lines and a…
Normalize text line endings deliberately
Replace CRLF and standalone CR with LF when a text-processing workflow needs one line-ending convention. Apply this only to text whose content permits that…
Create a conservative display filename
For a generated download label, use a conservative filename policy and a fallback. Replacing problematic characters can improve portability, but it is not a…
Hash a small byte buffer with Web Crypto
Use crypto.subtle.digest to compute a SHA-256 digest of a small byte buffer. The Web Crypto digest operation accepts bytes; encode text explicitly when text is the…
Merge exported records by a stable key
Use a Map to apply later records as replacements for earlier records sharing the same ID. Decide whether an update replaces the whole record or merges individual…
Sort exported records with a deterministic tie key
When generating a comparison-friendly report, sort by an explicit primary field and a stable secondary identifier. A tie key makes the output less dependent on…
Read a user-selected text file in the browser
Use a file input and File.text to read a file the user deliberately selected. Validate size and parse errors before displaying imported content.
Treat a file’s MIME label as a hint
Do not treat File.type or a filename extension as proof of content. A file object can carry an inaccurate or empty MIME label; actual parsing and format validation…
Can a browser test measure your physical RAM?
A browser allocation test measures what a particular page can allocate under current conditions. It does not establish the total physical RAM in the computer or…
Investigate a tab crash without guessing the cause
A closed or reloaded tab does not identify one definitive cause. Record what happened and isolate the workload before concluding that memory, an extension, a browser…
Distinguish JavaScript heap from total browser memory
JavaScript heap measurements cover only part of a browser’s resource use. Images, native objects, graphics buffers, and other processes can make total browser memory…
Try a small, bounded byte-buffer allocation
Start with a modest typed-array allocation when investigating browser memory behavior. Keep the byte count explicit and do not use an unbounded loop that keeps…
Why memory may stay high after removing a reference
Making an object unreachable allows garbage collection but does not force immediate collection or an immediate drop in process memory. Separate logical reachability…
Make a repeatable browser memory-leak check
Investigate a suspected leak with a repeatable action and comparable snapshots. Persistent growth after repeated create-and-remove cycles is more useful evidence than…
Avoid retaining removed DOM nodes
Removing a node from the document does not destroy JavaScript references to it. A detached node can remain alive if application state, a listener closure, or…
Why a small image download can use much more memory
Compressed download size and decoded image memory are different quantities. Pixel dimensions can make a highly compressed image expensive to decode and display even…
Account for Base64 copies during file processing
Base64 represents three input bytes with four output characters before padding details. Converting a large file into Base64 can therefore increase payload size and…
Why reading a JSON file can create several copies
A JSON import can retain file bytes, a decoded text string, a parsed object graph, and derived arrays at the same time. A file that fits on disk may still exceed a…
Understand which pages share browser storage
Browser storage is generally scoped by origin, not by a page’s folder name. Pages with the same protocol, hostname, and port can share an origin even when they live…
Choose between localStorage and sessionStorage
Use localStorage for small origin-scoped values that may persist across sessions, and sessionStorage for values scoped to a page session. Both APIs store strings and…
Inspect an estimated browser storage quota
Use navigator.storage.estimate when available to inspect an origin’s estimated usage and quota. These are browser-managed storage figures, not free physical RAM or a…
Handle browser storage quota failures
Catch storage write failures and preserve a usable recovery path. Quota exhaustion, privacy settings, and restricted contexts can all make a write fail even when the…
Request persistent storage when it is justified
Persistent storage can reduce automatic eviction risk for important offline data. Check support and request it in a user-appropriate workflow rather than assuming a…
Remove only your tool’s browser-storage keys
Prefer removing a known application key to calling localStorage.clear. Tools sharing an origin may store unrelated data in the same area, so broad cleanup can erase…
Do not rely on private-mode data surviving
Private browsing changes the lifetime and availability of browser data. Treat local saved state as temporary in that context and offer an explicit export for…
Why a page opened from disk behaves differently
A page opened with a file URL can have different origin, storage, and fetch behavior from the same page served over HTTP. Test a website through a local server before…
Check whether a service worker serves stale content
If a deployed page stays stale after an update, inspect service-worker registrations and cache behavior before repeatedly editing the source. A registered worker can…
Distinguish browser cache from CDN cache
A hard reload changes browser cache behavior but may still receive a stale response from a CDN or service worker. Inspect response headers and content at each layer…
Find out whether a download was created or blocked
When a download appears missing, first establish whether the browser started it. Check the downloads interface, response status, suggested filename, and any blocking…
Release object URLs when a preview is finished
An object URL lets a page refer to a Blob without embedding all its bytes in a data URL. Revoke it when the preview or download no longer needs it, not immediately…
Use a worker to preserve interface responsiveness
A Web Worker can run CPU-heavy processing away from the page’s main thread. It can make the interface more responsive, but does not automatically reduce total memory…
Handle clipboard access failures gracefully
Clipboard writes can require a secure context, browser permission, and a direct user interaction. Trigger copying from a visible control and provide a manual fallback…
Check whether a page is a secure context
Use window.isSecureContext when diagnosing an API that requires a trustworthy context. HTTPS is the usual deployed requirement, while browsers can also treat certain…
Treat permission state as context-specific
The Permissions API can expose a supported permission’s state, but not every browser supports every descriptor. Query defensively and still handle the actual…
Separate a DNS failure from a website error
If the browser cannot resolve a hostname, the request has not reached the normal HTTP page-response stage. A 404 or 500 is a different failure because an HTTP…
Do not treat navigator.onLine as an API health check
Navigator.onLine is a connectivity hint, not proof that your particular API is reachable. Attempt the real request and handle its outcome even when the browser…
Check whether a browser extension changes a page
Use a controlled clean profile or selectively disabled extensions when a page behaves differently on one browser installation. Compare the same URL and input rather…
Why timers slow down in background tabs
Browsers can throttle timers and other work when a tab is hidden. A delayed interval does not necessarily mean a script has stopped or the server has failed.
Calculate who does not follow you back from two lists
To find accounts you follow that do not follow you back, subtract the followers list from the following list. Keep the direction explicit: following minus followers…
Find mutual accounts in exported relationship lists
Mutual accounts are present in both the followers and following lists. Compute an intersection rather than adding both lists together or treating either list alone as…
Find followers you do not follow back
Followers you do not follow back are followers minus following. This is the reverse of the usual report for accounts that do not follow you back, and the labels…
Why one export cannot prove who recently unfollowed you
A single comparison can show which supplied relationships are nonmutual. It cannot establish when a relationship changed or whether an account ever followed you in…
Compare older and newer follower snapshots
Subtract a newer follower set from an older follower set to find usernames missing from the newer snapshot. Label the output as snapshot differences and keep the…
Choose JSON for the follower checker
The site’s follower checker accepts extracted JSON relationship files. An HTML export is easier to browse manually but is not the JSON structure the current parser…
Extract the archive before selecting follower files
The current checker reads individual JSON files, not a ZIP archive. Extract the archive with your device’s file manager and locate the relationship files before…
Include every follower JSON part from one export
An export can contain multiple follower files. Select all relevant parts from the same export on the follower side so the comparison does not mistake omitted records…
Understand the follower JSON shape this checker reads
For the follower-array format supported by the current checker, a username is read from the first entry in string_list_data. Inspecting a synthetic record makes…
Understand the following JSON wrapper this checker reads
The current checker supports a following object with a relationships_following array. In that branch, it uses each row’s title as the username rather than the…
Convert export timestamps from seconds to milliseconds
The checker interprets its relationship timestamp fields as Unix seconds and multiplies them by 1000 for JavaScript Date. Keep the unit explicit when inspecting a…
Keep missing relationship dates explicitly unknown
If a relationship record lacks a usable timestamp, report an unknown date rather than substituting the current time or epoch. A fallback date can look authoritative…
Choose a username-normalization policy explicitly
Decide which username representations count as the same identifier before comparing exports. The current checker uses extracted username strings as Map keys and does…
Why raw record counts can exceed unique account counts
The checker builds username maps, so repeated records for the same exact username count as one account. Compare raw rows and unique identifiers separately when…
Treat any file-processing alert as an incomplete comparison
If the checker reports that a selected file could not be processed, do not treat the displayed results as a complete comparison. Its current parser can continue after…
What local processing means for the follower checker
The implemented comparison reads selected files with FileReader and performs parsing and comparison in the browser. That describes the comparison code; it is not a…
Understand the checker’s hidden-profile setting
Hiding a profile in the checker changes its local presentation. The hidden username list is stored in localStorage; it does not unfollow, block, or change the account…
Read the nonmutual percentage with the right denominator
The checker’s displayed nonmutual percentage divides visible non-following-back accounts by total unique following accounts. Hidden profiles can therefore change the…
Select only the account-export data needed for comparison
A follower comparison needs relationship lists, not a complete archive of messages, photos, and other account activity. Use the platform’s current information-export…
Reconcile counts before trusting a relationship comparison
When counts differ from expectations, verify export identity, scope, completeness, and parser behavior before interpreting the result as a real relationship change. A…
A JavaScript queue with Snowcone: FIFO without Array.shift()
Use Snowcone’s Queue in Node.js for FIFO processing and breadth-first search. Learn its API, head-index design, amortized costs, and limits.
A JavaScript stack with Snowcone: push, pop, and peek
Use Snowcone’s Stack in Node.js for LIFO operations and bracket matching. See runnable examples, empty-stack behavior, and native array alternatives.
Read a file line by line in Node.js with Snowcone
Use Snowcone readLines with for await...of to process text incrementally in Node.js. Includes error handling, early exit, batching, and memory limits.
No matching articles. Try another title or topic.