js if property exists in one object, put it in another 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