coderef

Object.hasOwn()Baseline · Widely available

The Object.hasOwn() static method checks whether an object has a given property. It's a more robust alternative to the Object.prototype.hasOwnProperty() method.

Supported in all major browsers for at least 30 months — safe to use without fallbacks. Baseline since Mar 14, 2022. Widely available since Sep 14, 2024.

Browser support

DesktopChrome
1–92Not supported
93+Supportedsince Aug 31, 2021
Current: 155
Edge
12–92Not supported
93+Supportedsince Sep 2, 2021
Current: 154
Firefox
1–91Not supported
92+Supportedsince Sep 7, 2021
Current: 157
Safari
1–15.3Not supported
15.4+Supportedsince Mar 14, 2022
Current: 27
MobileChrome Android
18–92Not supported
93+Supportedsince Aug 31, 2021
Current: 155
Firefox Android
4–91Not supported
92+Supportedsince Sep 7, 2021
Current: 157
Safari iOS
1–15.3Not supported
15.4+Supportedsince Mar 14, 2022
Current: 27

How to use

This feature is Baseline widely available — use it freely, no fallback needed.

Example

Full syntax and examples are on MDN: hasOwn.

Feature detection

JS · check before using
if ("hasOwn" in Object || ("prototype" in Object && "hasOwn" in Object.prototype)) {
  // Object.hasOwn is available
}

Documentation (MDN)

Specification