how to find the property of a value an object contains code example
Example: object contains property javascript
if (x.hasOwnProperty('y')) {}
//or
if ('y' in x) {}
//or
if (x?.y){}
if (x.hasOwnProperty('y')) {}
//or
if ('y' in x) {}
//or
if (x?.y){}