Courses / JavaScript
26. Object.prototype.hasOwnProperty()
Returns a boolean indicating whether the object has the specified property as its own property.
1 min read Chapter 26 of 99
JavaScript
Object.prototype.hasOwnProperty()
It checks if an object has a specific property as its own, not inherited.
"I need to know if this object really has that property and it's not just coming from its prototype."
`hasOwnProperty()` returns `true` if the object has the specified property directly on itself, otherwise it returns `false`.
"I need to know if this object really has that property and it's not just coming from its prototype."
`hasOwnProperty()` returns `true` if the object has the specified property directly on itself, otherwise it returns `false`.