Test name | Executions per second |
---|---|
Object.prototype.hasOwnProperty | 7171232.5 Ops/sec |
obj.hasOwnProperty | 14153942.0 Ops/sec |
null check | 7326758.0 Ops/sec |
null check function | 7357636.5 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');