null is a special value meaning "no value". null is a special object because typeof null returns 'object'.
On the other hand, undefined means that the variable has not been declared, or has not been given a value.
Following snippets display 'undefined':
// i is not declared anywhere in code
Although null and undefined are slightly different, the == (equality) operator considers them equal, but the === (identity) operator doesn't.
Want automatic updates?
Subscribe to our RSS feed
Get Email Updates
sent directly to your inbox!