Null object: Difference between revisions

Content added Content deleted
Line 452: Line 452:


=={{header|JavaScript}}==
=={{header|JavaScript}}==
In Javascript null is the value that isn't anything. null is an object.
In Javascript <tt>null</tt> is the value that isn't anything. <tt>null</tt> is not an object, but because of a bug <tt>typeof null</tt> will return "object".
<lang javascript>if (object === null) {
<lang javascript>if (object === null) {
alert("object is null");
alert("object is null");
// The object is nothing
}
}


typeof null === 'object'; // This stands since the beginning of JavaScript</lang>
typeof null === "object"; // This stands since the beginning of JavaScript</lang>


=={{header|K}}==
=={{header|K}}==