JavaScript: NULL vs Undefined
What is the difference between them? Let’s type some code:
In both cases, we have similar errors.
Next, we create a function:
But what if we declare bar
property as null
:
Now it is clear, that null means that variable is defined
, but has no value
. Undefined means that there is no such variable at all.