Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36
Chrome 106
Linux
Desktop
2 years ago
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
Script Preparation code:
AخA
 
window.obj = { a: 2 }
Tests:
  • Object.prototype.hasOwnProperty

     
    Object.prototype.hasOwnProperty.call(obj, 'a');
  • obj.hasOwnProperty

     
    obj.hasOwnProperty('a');
  • null check

     
    obj.hasOwnProperty && obj.hasOwnProperty('a');
  • null check function

     
    typeof obj.hasOwnProperty === 'function' && obj.hasOwnProperty('a');