HTML and CSS Reference
In-Depth Information
> n = null
null
Confusingly, null is considered to be of type object:
> typeof n
"object"
This is another bug in the JavaScript language that has been maintained for backwards
compatibility. Despite this, null is genuinely a unique data type in JavaScript.
It is possible to set a variable to null after it has been assigned a value, therefore removing
the reference to its current value (and changing its data type):
> q = 2
2
> typeof q
"number"
> q = null
null
> typeof q
"object"
Undefined
The undefined data type is returned when you access a property on an object that does not
exist, or use a variable before it is declared, or before it is assigned a value.
Search WWH ::




Custom Search