What is NaN property in JavaScript?
Answers (1)
Add AnswerThe “Not-a-Number” value is represented by the NaN attribute. It denotes a value that isn’t a valid number.
A Number will be returned if typeof is applied to a NaN.
The isNaN() method is used to determine if a value is NaN.
**Note: The isNaN() function converts a value to a Number type, which it then equates to NaN.
isNaN("Hello") // Returns true isNaN(345) // Returns false isNaN('1') // Returns false, since '1' is converted to Number type which results in 0 ( a number) isNaN(true) // Returns false, since true converted to Number type results in 1 ( a number) isNaN(false) // Returns false isNaN(undefined) // Returns true