Tin mới
JavaScript: Scripting language
Web APIs: Programming interfaces
Structuring content with HTML module
Dynamic scripting with JavaScript module
Object.prototype.hasOwnProperty()
Note: Object.hasOwn() is intended as a replacement for Object.prototype.hasOwnProperty().
The Object.hasOwn() method returns true if the specified property is a direct property of the object — even if the property value is null or undefined. The method returns false if the property is inherited, or has not be
Checking if an Array index exists
The elements of an Array are defined as direct properties, so you can use hasOwn() method to check whether a particular index exists:
Enumerability and ownership of properties
Inheritance and the prototype chain
This page was last modified on Jul 20, 2025 by MDN contributors.