Question: how to check if an object has a specific property in javascript?
Answer: The first way is to invoke object. hasOwnProperty(propName) . The method returns true if the propName exists inside object , and false otherwise. Note that hasOwnProperty() searches only within the own properties of the object.