What are the differences between null and undefined?

The differences between null and undefined are given below:

NullUndefined
It indicates that variable points to no object.It indicates that variable has been declared but not yet assigned a value.
Type of null is objectType of undefined is undefined
The null value is a primitive valueThe undefined value is a primitive value
Indicates the absence of a value for a variableIndicates absence of variable itself
Converted to zero (0) while performing primitive operationsConverted to NaN while performing primitive operations
    var userName;
    console.log(userName);        //shows undefined
    console.log(typeof userName); //shows undefined
            
    var userName = null;
    console.log(userName);         //shows null
    console.log(typeof userName); //shows object
            

Special cases about null and undefined

null === undefined // false
null == undefined // true
null === null // true
null = 'value' // ReferenceError
undefined = 'value' // 'value'