NaN === NaN is false in JavaScript

How to check for NaN when checking for a number in JavaScript

NaN is the only JavaScript value not equal to itself, so if you see a check for self-equality in JavaScript it is a NaN check, equivalent to Number.isNaN().

Image for post
Image for post
Photo by Rattap on Unsplash

Written by

🤓 The physical therapist who writes JavaScript 💪 Web Developer 😎 Mentor 🧠 DPT 😄 SEO Expert 😁 React 😆 Jamstack 🗯️ Ask me anything 👉 DoctorDerek.com 👈

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store