It is somehow difficult to check if the value is exactly a real object. For example, null is not an object, but the result of typeof null is "object", which is an error in typeof. Null is a special value with a separate type of its own.
To check if a value is an object, the constructor of the value can be compared to Object.
- and Object is a non-primitive data type.
All of these types are incapable of being changed except objects. Those that are unchangeable are called primitive values.
The typeof operator
The typeof operator helps us to see which type is stored in a variable. It supports two forms of syntax:
As an operator:
As a function:
It can work either with parentheses or without, the result will be the same.