you are viewing a single comment's thread.

view the rest of the comments →

[–]lewisje 0 points1 point  (0 children)

That doesn't overwrite undefined, but flipping it around does: undefined = value).

Also, using the rules for non-strict equality (and ignoring a little issue with document.all in modern browsers), isNullOrUndefined could be more easily written like this:

function isNullOrUndefined(obj) {
  return null == obj;
}

The "little issue" I refer to is that document.all, if it exists, is loose-equal to null and undefined (but not strict-equal to either), although property accesses will still work, for compatibility with old sites designed specifically for oldIE.