--- title: 'null' slug: Web/JavaScript/Reference/Global_Objects/null translation_of: Web/JavaScript/Reference/Global_Objects/null ---
The value null
represents the intentional absence of any object value. It is one of JavaScript's {{Glossary("Primitive", "primitive values")}}.
null
The value null
is written with a literal, null
(it's not an identifier for a property of the global object like {{jsxref("Global_Objects/undefined","undefined")}} can be). In APIs, null
is often retrieved in place where an object can be expected but no object is relevant. When checking for null or undefined beware of the differences between equality (==) and identity (===) operators (type-conversion is performed with the former).
// 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"
null
and undefined
typeof null // object (bug in ECMAScript, should be null) typeof undefined // undefined null === undefined // false null == undefined // true
Specification | Status | Comment |
---|---|---|
{{SpecName('ES1')}} | {{Spec2('ES1')}} | Initial definition. |
{{SpecName('ES5.1', '#sec-4.3.11', 'null value')}} | {{Spec2('ES5.1')}} | |
{{SpecName('ES6', '#sec-null-value', 'null value')}} | {{Spec2('ES6')}} | |
{{SpecName('ESDraft', '#sec-null-value', 'null value')}} | {{Spec2('ESDraft')}} |
{{CompatibilityTable}}
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} |
Feature | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} |