
The Safest Way to Test for NaN in JavaScript
Why equality, typeof and global isNaN() are unreliable JavaScript NaN checks, and when Number.isNaN() provides a safer modern alternative in practice.
Articles
Testing is the work of checking behaviour before users do it for us in production. My articles here are less interested in maximising test count than in choosing the lightest check that still catches the real risk, especially when rendered component behaviour matters more than an implementation detail.

NaN in JavaScriptWhy equality, typeof and global isNaN() are unreliable JavaScript NaN checks, and when Number.isNaN() provides a safer modern alternative in practice.

Compare React 17, React 18's legacy root, and createRoot. Find premature DOM reads during an upgrade and test layout effects before reaching for flushSync.

Test Next.js pages in a production build. Compare HTTP statuses, redirects, and serialised props with what happens when someone follows a link.

Test a Next.js static export on an ordinary file server: deep links, language paths, subdirectory assets, real 404s, and features that still need a server.


Follow request IDs through Node.js promises and callbacks. Reproduce lost context, repair a shared queue, and keep concurrent requests and worker jobs separate.

Limit active requests in a Node.js CMS import, honour Retry‑After, handle duplicate pages, and retain ordered outcomes without starting the whole queue at once.

Keep translated Next.js pages connected by content ID: switch language without losing the story, handle missing translations, and check canonical URLs.

Bugs and defects describe faults; issues track work; incidents need an operational response. How to use these labels without confusing impact with priority.

Keep the previous generated JSON usable when a Node.js build fails. Stage and validate replacements, then publish one file or a complete versioned set.

Replace Next.js getInitialProps with a tested route contract. Preserve account data, navigation, errors, and shared state whilst restoring static eligibility.

Process large files in Node.js without keeping every record in memory. Connect backpressure, test slow consumers, and protect output when conversion fails.