Question: javascript best way to check if object has property?
Answer: There are mainly 3 ways to check if the property exists. The first way is to invoke object. hasOwnProperty(propName) . The method returns true if the propName exists inside object , and false otherwise.