-2

I can not understand what is the main difference between null and undefined.

2
  • 3
    How much research effort is expected of Stack Overflow users? Commented Aug 31, 2021 at 6:20
  • console.log(a) : a is undefined. It doesn't exist at all. typeof a === "undefined". But if you do const a = null, then a is defined. Its value is a null object, but it is defined and exists. typeof a === "object". Commented Aug 31, 2021 at 12:46

1 Answer 1

1

Null: It is the intentional absence of the value. It is one of the primitive values of JavaScript.

Undefined: It means the value does not exist in the compiler. It is a global object.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.