Why are these 2 conditionals different:
if (myObj !== null && typeof myObj !== "undefined")
if (typeof myObj !== "undefined" && myObj !== null)
The first condition will throw an error if the variable is undeclared.
ReferenceError: myObj is not defined
Note that the && operator is short-circuiting, so in the second condition, the
myObj !== null expression will not be evaluated at all if myObj is undefined.
See here for details.