Understanding the difference between null and undefined
null
to any variable which basically means it’s blank.undefined
. However, when you assign null
to a variable, you are declaring that this value is explicitly empty.null
. That must be done by you in your code.null
is an object but the type of undefined
is undefined.===
, we get false
.==
, we get true
.null
or undefined
, you can check for abstract equality and compare it to either null or undefined. Both will return the same result.