Question: javascript check if object has specific property?
Answer: hasOwnProperty() method The JavaScript object has a special method object. hasOwnProperty(propName) that returns a boolean that indicates whether object has a property propName . The property name exists in the object hero : thus hero. hasOwnProperty('name') returns true .