Search code examples
javascriptnulltypeof

JavaScript: What is the data type of null?


It is said that null, in JavaScript, is a primary type. However, when I use the operator typeof on null, it returns "Object".

What is the underlying procedure that made typeof to return "Object" instead of "Primitive" or "null"?


Solution

  • Type of null is object.

    you can check type of any variable with typeof keyword. for example

    typeof null
    

    check the link below for more details.