What is the difference between the "NaN" and the "undefined" in JavaScript? Please help me to understand 👋🏼😊 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

What is the difference between the "NaN" and the "undefined" in JavaScript? Please help me to understand 👋🏼😊

7th Jul 2019, 3:34 AM
Bastien GERMANY
Bastien GERMANY - avatar
5 Answers
+ 3
NaN: Not a number: As the name implies, it is used to denote that the value of an object is not a number. There are many ways that you can generate this error, one being invalid math operations such as 0/0 or sqrt(-1). Undefined: It means that the object doesn't have any value, therefore undefined. This occurs when you create a variable and don't assign a value to it.
14th Jul 2019, 6:38 PM
Emmanuel Massawe
Emmanuel Massawe - avatar
+ 4
NaN = Not_a_Number Undefined = //no one defined it !!
7th Jul 2019, 9:41 AM
Ayan Fox
Ayan Fox - avatar
+ 3
Bastien GERMANY (LeGerme) that's a confusing question 😵. No one defined that it's undefined 😆
7th Jul 2019, 3:11 PM
Ayan Fox
Ayan Fox - avatar
+ 1
7th Jul 2019, 3:44 AM
Diego
Diego - avatar
0
Is it really true Dead ? 🤔
7th Jul 2019, 3:08 PM
Bastien GERMANY
Bastien GERMANY - avatar