node check if property exists code example
Example 1: check if js property exists in class
myObj.hasOwnProperty(myProp)
Example 2: test if property exists javascript
const hero = {
name: 'Batman'
};
hero.hasOwnProperty('name'); // => true
hero.hasOwnProperty('realName'); // => false