An “undefined variable” is different from the value undefined
.
An undefined variable:
var a; alert(b); // ReferenceError: b is not defined
A variable with the value undefined
:
var a; alert(a); // Alerts “undefined”
When a function takes an argument, that argument is always declared even if its value is undefined
, and so there won’t be any error. You are right about != null
followed by !== undefined
being useless, though.