null (Primitive value)

A built-in primitive value.

Availability:

ECMAScript edition - 2
JScript - 5.0
Internet Explorer - 5.0
Property/method value type:Null primitive
JavaScript syntax:IEnull

The null value is a primitive value that represents the null, empty, or non-existent reference.

This is equivalent to the Java null data type when passing values back and forth between JavaScript and Java.

If you don't have a null keyword, you may be able to simulate a null value like this:

var null = (void 0);

The null and undefined values are subtly different. An empty thing is not the same as a non-existent thing. However in a browser it is difficult to distinguish between them.

The null value is now provided in some browsers as a built-in keyword, but the undefined value is not.

See also:Cast operator, JavaScript to Java values, LiveConnect, NaN, undefined

Cross-references:

ECMA 262 edition 2 - section - 4.3.11

ECMA 262 edition 3 - section - 4.3.11

O'Reilly JavaScript Definitive Guide - page - 47