From the MDN page about the behaviour of the typeof operator:

null

// This stands since the beginning of JavaScript
typeof null === 'object';

In the first implementation of JavaScript, JavaScript values were represented as a type tag and a value. The type tag for objects was 0. null was represented as the NULL pointer (0x00 in most platforms). Consequently, null had 0 as type tag, hence the "object" typeof return value. (reference)

A fix was proposed for ECMAScript (via an opt-in), but was rejected. It would have resulted in typeof null === 'null'.

Answer from Deepak Ingole on Stack Overflow
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Operators › null
null - JavaScript - MDN Web Docs
Like undefined, accessing any property on null throws a TypeError instead of returning undefined or searching prototype chains. Like undefined, null is treated as falsy for boolean operations, and nullish for nullish coalescing and optional chaining. The typeof null result is "object". This is a bug in JavaScript that cannot be fixed due to backward compatibility.
Discussions

Why is `typeof null === 'object'` in JavaScript? The 30-year story of a bug we can't fix
I don't know if I am conditioned to it now, but the null as an object, NaN as number, Nan !== NaN has started making sense to me. Therefore, I welcomed the nullish coalescing operator instead of the short-circuiting or operator. More on reddit.com
🌐 r/javascript
67
138
October 14, 2025
javascript - Why is null an object and what's the difference between null and undefined? - Stack Overflow
Bring the best of human thought and AI automation together at your work. Explore Stack Internal ... Save this question. Show activity on this post. ... Null is not an object in JavaScript! typeof null === 'object' but that's a bug! More on stackoverflow.com
🌐 stackoverflow.com
Undefined vs null
One reason to favor undefined over null is how javascript handle default values: const withDefault = (a = true) => { console.log(a); }; withDefault(); // logs true withDefault(undefined); // logs true withDefault(null); // logs null More on reddit.com
🌐 r/typescript
51
46
February 27, 2023
how do I check if the type of data type is null?
You don't need to use typeof to check for null or undefined, you can just use strict equality operator '===' if (jsType === null) { ... } More on reddit.com
🌐 r/learnjavascript
9
3
October 16, 2023
🌐
web.dev
web.dev › learn › javascript › data-types › null-undefined
null and undefined | web.dev
The strict equality operator considers operands of different data types to be unequal. null == undefined > true null === undefined > false · Unlike the reserved keyword null, undefined is a property of the global object.
🌐
Medium
medium.com › @seema.workforce › what-is-the-typeof-null-d288e2da6557
what is the typeof null?. In JavaScript, when you use typeof on… | by Seema | Medium
November 8, 2024 - Despite the fact that null is actually a primitive value and not an object, typeof null will always return "object". Because of this odd behavior, if you need to check whether a variable is specifically null, you should use the strict equality ...
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › null-in-javascript
Null in JavaScript - GeeksforGeeks
June 5, 2024 - In JavaScript, `null` indicates the deliberate absence of any object value. It's a primitive value that denotes the absence of a value or serves as a placeholder for an object that isn't present.
🌐
DEV Community
dev.to › elmarshall › javascript-typeof-null-52k0
JavaScript: typeof null - DEV Community
May 29, 2020 - typeof returns the value type, and === strictly evaluates equality. x is null, so we'd expect to get null, and true. Logical. Unfortunately, what you actually get is object, true. That's right, null is an object... But doesn't that seem off? Well, this is due to a quirk of the way null was defined in the early days of JavaScript, and can’t be altered at this point.
🌐
Programiz
programiz.com › javascript › null-undefined
JavaScript null and undefined
In JavaScript, null is treated as an object. You can check this using the typeof operator. The typeof operator determines the type of variables and values.
Find elsewhere
🌐
Reddit
reddit.com › r/javascript › why is `typeof null === 'object'` in javascript? the 30-year story of a bug we can't fix
r/javascript on Reddit: Why is `typeof null === 'object'` in JavaScript? The 30-year story of a bug we can't fix
October 14, 2025 - AFAIK, it was needed for null pointer exception compatibility with Java, so yeah it's not a bug in JS, it's a bug in strongly typed languages like Java or Go. ... No, it was not. The creator of JavaScript quite literally forgot to have an “if (value == null)” check before checking for the object tag which is 0x000, and since a null pointer is all zeroes, the null value evaluates to true for the object tag.
🌐
W3Schools
w3schools.com › js › js_typeof.asp
JavaScript typeof
The typeof of a variable with no value is undefined. The value is also undefined. ... Any variable can be emptied, by setting the value to undefined. The type will also be undefined. let car = "Volvo"; car = undefined; Try it Yourself » · An empty value has nothing to do with undefined. An empty string has both a legal value and a type. ... In JavaScript null is "nothing".
🌐
JavaScript in Plain English
javascript.plainenglish.io › guess-what-typeof-null-returns-in-javascript-90cb86d2379d
What does “typeof null” return in JavaScript? | by Mohith Gupta | JavaScript in Plain English
November 20, 2023 - When Brendan Eich created JavaScript, he followed the same paradigm, and it made sense (arguably) to return "object". In fact, the ECMAScript specification defines null as the primitive value that represents the intentional absence of any object value (ECMA-262, 11.4.11). A fix was proposed (try to go through the proposal, it’s quite interesting) for ECMAScript (via an opt-in) but was, obviously, rejected. It would have resulted in typeof null === null
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › null
null - JavaScript | MDN
May 23, 2022 - Like undefined, accessing any property on null throws a TypeError instead of returning undefined or searching prototype chains. Like undefined, null is treated as falsy for boolean operations, and nullish for nullish coalescing and optional chaining. The typeof null result is "object". This is a bug in JavaScript that cannot be fixed due to backward compatibility.
🌐
Medium
medium.com › @maciejpoppek › understanding-data-types-in-javascript-null-undefined-and-beyond-f3674995c9f8
Understanding Data Types in JavaScript: null, undefined, and Beyond | by Maciej Poppek | Medium
August 19, 2024 - Type: null is an object, while undefined is a type unto itself. Usage: null is used to indicate an intentional absence of value. undefined indicates that a variable has been declared but not yet assigned a value.
🌐
Mastering JS
masteringjs.io › tutorials › fundamentals › null
`null` in JavaScript - Mastering JS
December 2, 2020 - For most practical purposes, null and undefined are often interchangeable as the only two nullish values. Nullish values are different from non-nullish values in that nullish values throw a TypeError when you try to access one of their properties, whereas non-nullish values do not.
🌐
Dmitri Pavlutin
dmitripavlutin.com › javascript-null
Everything about null in JavaScript - Dmitri Pavlutin
September 21, 2020 - null, alongside false, 0, '', undefined, NaN, is a falsy value. If a falsy value is encountered in conditionals, then JavaScript coerces falsy to false. ... typeof value operator determines the type of value.
🌐
W3Schools
w3schools.com › js › js_datatypes.asp
JavaScript Data Types
JS Examples JS HTML DOM JS HTML Input JS HTML Objects JS HTML Events JS Browser JS Editor JS Exercises JS Quiz JS Website JS Syllabus JS Study Plan JS Interview Prep JS Bootcamp JS Certificate JS Reference ... A JavaScript variable can hold 8 types of data. ... The Object data type can hold many different object types. // Number let length = 16; let weight = 7.5; // BigInt let x = 1234567890123456789012345n; let y = BigInt(1234567890123456789012345) // Strings let color = "Yellow"; let lastName = "Johnson"; // Boolean let x = true; let y = false; // Undefined let x; let y; // Null let x = null; let y = null; // Symbol const x = Symbol(); const y = Symbol(); // Object const person = {firstName:"John", lastName:"Doe"}; // Array Object const cars = ["Saab", "Volvo", "BMW"]; // Date Object const date = new Date("2022-03-25");
🌐
Scaler
scaler.com › home › topics › javascript › null and undefined in javascript
Null and Undefined in JavaScript - Scaler Topics
April 4, 2024 - Null in JavaScript means an empty value and is also a primitive type in JavaScript. The variable which has been assigned as null contains no value. Undefined, on the other hand, means the variable has been declared, but its value has not been ...
Top answer
1 of 16
1534
Copy(name is undefined)

You: What is name? (*)
JavaScript: name? What's a name? I don't know what you're talking about. You haven't ever mentioned any name before. Are you seeing some other scripting language on the (client-)side?

Copyname = null;

You: What is name?
JavaScript: I don't know.

In short; undefined is where no notion of the thing exists; it has no type, and it's never been referenced before in that scope; null is where the thing is known to exist, but it's not known what the value is.

One thing to remember is that null is not, conceptually, the same as false or "" or such, even if they equate after type casting, i.e.

Copyname = false;

You: What is name?
JavaScript: Boolean false.

Copyname = '';

You: What is name?
JavaScript: Empty string


*: name in this context is meant as a variable which has never been defined. It could be any undefined variable, however, name is a property of just about any HTML form element. It goes way, way back and was instituted well before id. It is useful because ids must be unique but names do not have to be.

2 of 16
147

The difference can be summarized into this snippet:

Copyalert(typeof(null));      // object
alert(typeof(undefined)); // undefined

alert(null !== undefined) //true
alert(null == undefined)  //true

Checking

object == null is different to check if ( !object ).

The latter is equal to ! Boolean(object), because the unary ! operator automatically cast the right operand into a Boolean.

Since Boolean(null) equals false then !false === true.

So if your object is not null, but false or 0 or "", the check will pass because:

Copyalert(Boolean(null)) //false
alert(Boolean(0))    //false
alert(Boolean(""))   //false
🌐
MDN Web Docs
devdoc.net › web › developer.mozilla.org › en-US › docs › JavaScript › Reference › Global_Objects › null.html
null - JavaScript | MDN
In APIs, null is often retrieved in a place where an object can be expected but no object is relevant. // foo does not exist. It is not defined and has never been initialized: foo; "ReferenceError: foo is not defined" // foo is known to exist now but it has no type or value: var foo = null; foo; "null"