object contains property javascript 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){}