← flaviocopes.com

The Object hasOwnProperty() method

Published Apr 17 2019

Called on an object instance, accepts a string as argument. If the object has a property with the name contained in the string argument, it returns true. Otherwise it returns false.


const person = { name: 'Fred', age: 87 }
person.hasOwnProperty('name') //true
person.hasOwnProperty('job') //false

Wanna go from noobie to expert?

I wrote an entire book on this topic 👇

I also got a super cool course 👇

© 2023 Flavio Copes Flavio Copes using Notion to Site Notion to Site

Interested in solopreneurship?