typescript check if key exists code example
Example 1: check if key exists in json typescript
if (cell.hasOwnProperty('Relationships')) {
console.log("Key Found!!");
}
else {
console.log("Not Found.");
}
Example 2: javascript hashtable contains key
if (obj.hasOwnProperty("key1")) {
...
}
Example 3: check if a key exists in an object javascript
"key" in obj // true, regardless of the actual value