Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

null
javascript

What is JavaScript null?

Educative Answers Team

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Answers Code

The null value represents the intentional absence of any object value; it is one of JavaScript’s primitive values.

The null value is written with a literal ​null.

svg viewer

​Unlike undefined, null is not an identifier for a property of the global object. Instead, null expresses a lack of identification; it​ indicates that the variable does not point to any object. In APIs, null is often retrieved in a place where an object can be expected, but no object is relevant.

Code

Take a look at the example below, which highlights the use of null:

my_var;
// Executing the above statement will result in a "ReferenceError: my_var is not defined"
// my_var does not exist. It is not defined and has never been initialized:
var my_var = null;
my_var;
// my_var is known to exist now but it has no type or value:
// Executing the above statement will not throw an error"

RELATED TAGS

null
javascript
Copyright ©2022 Educative, Inc. All rights reserved

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Answers Code
Keep Exploring