Checking if a Value is a Number in JavaScript with isNaN()

Johnny Simpson
JavaScript in Plain English
4 min readFeb 7, 2023

--

In Javascript, we have numerous ways to check if something is or is not a number. This is a particularly common task in Javascript, where there is dynamic typing, resulting in some unexpected things being classified as numbers. Typescript fixes some of these issues, but in this guide we’ll cover how to check if something is a number in Javascript, and the pitfalls you should avoid when…

--

--