typescript check if property exists in class code example
Example 1: check if js property exists in class
myObj.hasOwnProperty(myProp)
Example 2: check if property exists javascript
// the coolest way
const obj = {
weather: 'Sunny;
}
if('weather' in obj) {
// do something
}