
Object.hasOwn() – Checks if the object has the given property as its **own property**, not inherited.
๐ Syntax
Object.hasOwn(obj, prop)
๐งช Example
const obj = { a: 1 };
console.log(Object.hasOwn(obj, 'a')); // true
Object.hasOwn() – Checks if the object has the given property as its **own property**, not inherited.
Object.hasOwn(obj, prop)
const obj = { a: 1 };
console.log(Object.hasOwn(obj, 'a')); // true
Comments
Post a Comment