HTML Preparation code:
Tests:
  • undefined !== nullObject[key]

  • "undefined" !== typeof nullObject[key]

  • key in nullObject

  • !!nullObject[key]

  • Object.hasOwn(nullObject, key)

  • Object.prototype.hasOwnProperty.call(nullObject, key)

  • Object.hasOwn(normalObject, key)

  • normalObject.hasOwnProperty(key)

  • map.has(key)

Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results
  • Test case name Result
    undefined !== nullObject[key]
    "undefined" !== typeof nullObject[key]
    key in nullObject
    !!nullObject[key]
    Object.hasOwn(nullObject, key)
    Object.prototype.hasOwnProperty.call(nullObject, key)
    Object.hasOwn(normalObject, key)
    normalObject.hasOwnProperty(key)
    map.has(key)

    Fastest: N/A

    Slowest: N/A

Get performance results from real users on your website with Request Metrics.
Latest run results:
Run details: (Test run date: 10 months ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36 OPR/101.0.0.0 (Edition beta)
Opera 101 on Windows
View result in a separate tab
Test name Executions per second
undefined !== nullObject[key] 657.7 Ops/sec
"undefined" !== typeof nullObject[key] 877.4 Ops/sec
key in nullObject 895.3 Ops/sec
!!nullObject[key] 878.7 Ops/sec
Object.hasOwn(nullObject, key) 654.1 Ops/sec
Object.prototype.hasOwnProperty.call(nullObject, key) 650.3 Ops/sec
Object.hasOwn(normalObject, key) 654.9 Ops/sec
normalObject.hasOwnProperty(key) 823.2 Ops/sec
map.has(key) 858.0 Ops/sec