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.
undefined: It means a variable declared, but no value has been assigned a value.
//example:
var demo;
alert(demo); //shows undefined
alert(typeof demo); //shows undefined
null: Whereas, null in JavaScript is an assignment value.
You can assign it to a variable.
//Example:
var demo = null;
alert(demo); //shows null
alert(typeof demo); //shows object
Undefined used for unintentionally missing values.
Null used for intentionally missing values.
null == undefined