JavaScript - Difference between undefined value and null value

What is the difference between undefined value and null value?

Undefined value: A value that is not defined and has no keyword is known as undefined value. For example in the declaration, int number; the number has undefined value.

Null value: A value that is explicitly specified by the key word ‘null’ is known as null value. For example in the declaration, String str=null; the str has a null value. The keyword ‘null’ is used here.

What is the difference between undefined value and null value?

- Null value has keyword called ‘null’. That is not the case with undefined.

- typeof undefined variable or property returns undefined whereas typeof null value returns object.
How to set the cursor to wait in JavaScript?
The cursor can set to wait in JavaScript by using the property ‘cursor’ property.
What is decodeURI(), encodeURI() in JavaScript?
What is decodeURI(), encodeURI() in JavaScript? - ...
Methods GET vs. POST in HTML forms
Encoding form data into URL is needed by the GET method. The form data is to be appeared within the message body...
Post your comment