Test name | Executions per second |
---|---|
Object.prototype.hasOwnProperty | 3085886.8 Ops/sec |
obj.hasOwnProperty | 6538540.5 Ops/sec |
null check | 3349970.5 Ops/sec |
null check function | 3325065.8 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');