Javascript: Undefined & Null

The Javascript Null & Undefined type are a little confusing, they represent nonexistence and incomplete existence respectively

An undefined variable is one that has been declared but has not been assigned a value:


var thing;

While a null variable is one that has not been declared or assigned the null value:


alert(thing);
var thing = null;