Null, it seems, is often mentioned in computer science. Perhaps it’s used a little loosely: it might refer to the value read when there’s nothing there, or the value of a variable that doesn’t exist.
- A variable that doesn’t exist at all is of type undefined. Trying to print its value will prevent the script from running.
- A variable that is declared but not given a value (eg var var1;) is also type undefined. However, the program will print its value as undefined.
A variable declared with a value null (eg var var1 = null;) is of type object. Its value will print out null.
Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.