Type of Null and Undefined
We can see that the type of null is an object but the type of undefined is undefined.
Comparison between null and undefined
If we compare both the data types we can see that if we use strict equality (===) then the result is false but if we compare them with abstract equality (==) then the result is true.
- null and undefined are falsy values.
- null !== undefined but null == undefined.
- null and undefined are both primitives. However, an error shows that typeof null = object.