ScanSkill

isNaN()

The isNaN() function determines whether the passed value is not a number. It also converts to numbers from strings to check if the passed value is a number or not.

Syntax

isNaN()

Example

const a = "1000", b = "asdasda";

console.log(isNaN(a)) // Prints: false

console.log(isNaN(b)); // Prints: true

The isNaN() function firstly converts the passed value to a number if it fails at that point it returns true. If it passes that condition then it returns false.