JavaScript defines two special types, which both have only one value assigned: null and undefined.

Those are very special.

null

null is a special value that indicates the absence of a value.

It’s a common concept in other languages as well, can be known as nil or None in Python for example.

undefined

undefined indicates that a variable has not been initialized and the value is absent.

It’s commonly returned by functions with no return value. When a function accepts a parameter but that’s not set by the caller, it’s undefined.


Go to the next lesson