Undefined variable: A variable that is declared but the value is not defined for that.
Undefined value: A value that is not defined and has no keyword is known as an undefined value.
Example:
var testNum; console.log(testNum); // undefined
Note: Undefined is of the type undefined.
var testNum; console.log(typeof testNum); // undefined
Null value: A value that is explicitly specified by the keyword “null” is known as a null value.
var test= null; console.log(test); // null
Note: null is of the type Object.
var test= null; console.log(typeof test); // object
Related topics:
- What is JavaScript?
- JavaScript advantages and disadvantages
- Javascript External file
- Javascript isNaN()
- Javascript Undefined and Null
- Javascript Create object
- JavaScript access cookie
- Javascript read cookie
- Javascript get cookie by name
- Javascript detete cookie
- Javascript redirect URL
- Javascript print webpage
- Javascript exceptions