We support #BlackLivesMatters !
If you support us then follow us by clicking here and following us!

What is null in javascript?

Get support on JavaScript,jQuery, AJAX and other related technology.
Post Reply
admin
Site Admin
Posts: 44

What is null in javascript?

Post by admin » Sun Oct 20, 2019 1:55 am

null is used for representing the intentional absence of an object value and is a primitive value. Unlike undefined, it is not a property of the global object.

It is equal to undefined but not identical to it.

Code: Select all

null == undefined; // true
null === undefined; // false
CAREFUL: The typeof null is 'object'.

Code: Select all

typeof null; // 'object';
To properly check if a value is null, compare it with the strict equality operator

Code: Select all

var a = null;
a === null; // true

Post Reply