Test name | Executions per second |
---|---|
Object.prototype.hasOwnProperty | 3010472.8 Ops/sec |
obj.hasOwnProperty | 6061138.0 Ops/sec |
null check | 3140007.8 Ops/sec |
null check function | 3140017.2 Ops/sec |
window.obj = { a: 2 }
Object.prototype.hasOwnProperty.call(obj, 'a');
obj.hasOwnProperty('a');
obj.hasOwnProperty && obj.hasOwnProperty('a');
typeof obj.hasOwnProperty === 'function' && obj.hasOwnProperty('a');