Check Given Property is Own Property of an Object in Javascript

You can check the given property is an own property of an object. You can use the hasOwnProperty() of the object

You can have the following output
>name is a property of product true
>price is a property of product false

Leave a Reply

Your email address will not be published. Required fields are marked *