+ 1
Undefined, null, NaN?
What is the difference between them?
2 odpowiedzi
+ 12
Adding to existing post info:
NaN stands for Not a Number.
+ 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.