Undefined, null, NaN? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Undefined, null, NaN?

What is the difference between them?

16th Mar 2017, 10:17 PM
Валерий Чкалов
Валерий Чкалов - avatar
2 Answers
+ 12
Adding to existing post info: NaN stands for Not a Number.
17th Mar 2017, 12:17 AM
Hatsy Rei
Hatsy Rei - avatar
+ 3
Undefined https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/undefined Null https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null They all represent JavaScript "primitive values". Undefined denotes that the variable/property does not exist, null means that the variable/property exists but it points to no meaningful value and NaN denotes a variable/property that isn't / couldn't be converted to a numeric value. You can directly assign them to variables.
16th Mar 2017, 10:54 PM
John Afolayan