Object property existance

Edit on GitHub

Setup

var a = {a: 5, b:59239};
var key = "asd";

Tests

  • hasOwnProperty by new Object

    {}.hasOwnProperty.call(a, key);
  • check for undefined

    a[key] === undefined;