What is the use of isNaN function? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 1

What is the use of isNaN function?

IsNaN function returns true if the argument is not a number otherwise it is false.

9th Oct 2019, 10:52 PM
Sebastian Uțoiu
Sebastian Uțoiu - avatar
3 Antworten
+ 1
To check if an input is valid is one use.
9th Oct 2019, 11:13 PM
Jacob Heath
Jacob Heath - avatar
+ 1
Examples: isNaN(NaN) // true isNaN("string") //true isNaN("12") // false isNaN(12) // false
9th Oct 2019, 11:19 PM
Stiven 98
Stiven 98 - avatar
0
It's correct. isNaN is a high level function and is not associated with any object. isNaN tries to convert the passed parameter to a number. If the parameter cannot be converted, it returns true; otherwise, it returns false.
9th Oct 2019, 11:16 PM
Stiven 98
Stiven 98 - avatar