Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

8
  • 1
    This Map[key] != null && Map[key] != undefined is not reliable and should not be used (even more: it's plain wrong). Commented Jun 9, 2011 at 19:36
  • 1
    Plain wrong in what sense... It's checking to see if a value is null or undefined, depending on what he wants to do that may help :\... Commented Jun 9, 2011 at 19:39
  • 1
    A value can be both null and undefined, this does not imply the property does not exist. Plus undefined can be redefined in JavaScript (try it!), so I would never rely on that. Commented Jun 9, 2011 at 21:48
  • 10
    If you redefine undefined you deserve any errors it causes. null indicates a deliberate non-value, whereas undefined indicates an uninitialized variable. Just because null == undefined will return true, doesn't mean null is exactly the same as undefined. Commented Jun 9, 2011 at 21:56
  • 1
    var x = {}; undefined = true; x.key1 = undefined; x.key1 === undefined; /* true */ x.key1 === true; /* true */ typeof x.key1 === "undefined"; /* false */ Commented Jun 9, 2011 at 22:19