🔍 Object.hasOwn() vs hasOwnProperty

Pick a scenario that exposes a failure mode in the classic obj.hasOwnProperty(key) approach — then see how Object.hasOwn(obj, key) handles it safely.

1 Choose a scenario
2 Enter a key to check
3 Results
obj.hasOwnProperty(key)
Object.hasOwn(obj, key)
4 The code for this scenario