Question: javascript determine if object has a 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 .