DEV Community

NEYAZ NAFIZ
NEYAZ NAFIZ

Posted on

undefined and null in JavaScript

Undefined means a variable has been declared but there is no value assigned yet in that variable. Unassigned variables are initialized by the default value of undefined in JavaScript. Good to said, the value does not exist in the compiler. It is the global object.

Null means an empty or non-existent value, null is also an object. Good to said, It is the intentional absence of the value. It is one of the primitive values of JavaScript.

Top comments (0)