Is this the correct way to check for a missing parameter in a function? Would this work in all browsers? How about IE?
function getName(name){ name = name !=
The correct way to check is
if (typeof name === "undefined") { // ... }
Of course callers can still "fool" you by calling getName(undefined), when a parameter has been provided but the check will flag it as not-provided nonetheless. But that's really a pathological scenario.
getName(undefined)