Firstly, it’s good to bear in mind that Null and Undefined are different.
Null !== Undefined
Undefined means a declared variable without any assigned value. Hence, it is not defined.
Null means that the variable is empty or non-existent. It is assigned and explicitly means nothing.
Undefined is a falsy value with an undefined typeof.
Null is a typeof of object.
Here, JSON categorize Undefined and Null Values. Undefined doesn’t come out in JSON, but null does.
Function parameters are undefined if not passed as argument. Not only that, passing undefined to them doesn’t override their default value:
Undefined does not strictly equal null but equals null when it’s not strict.
Here the values are compared to be equal before checking the data type.
Null loosely equals undefined when it’s not strict but does not strictly equal.
Here, undefined and null values are compared before we perform type coercion. This means we have to compare both values before we convert them to a common data type.
What's your reaction?