I want to know what the difference is between null and undefined in JavaScript.
null
undefined
Undefined means a variable has been declared but has no value:
var var1; alert(var1); //undefined alert(typeof var1); //undefined
Null is an assignment:
var var2= null; alert(var2); //null alert(typeof var2); //object