Object.hasOwn()
Object.hasOwn() returns true if the specified property is a direct property of the object, not inherited. It is a safer alternative to hasOwnProperty().
const obj = { a: 1 };console.log(Object.hasOwn(obj, "a")); // trueconsole.log(Object.hasOwn(obj, "toString")); // false