๐ฐproperty testing
check whether an object has a property.
'prop' in obj // in operator
Object.hasOwn(obj, 'prop') // recommended
obj.hasOwnProperty('prop') // not recommended
obj.propertyIsEnumerable('prop')
โญ the following methods/operators all support String / Symbol keys.
method/operator
own enum
own nonenum
inherited enum
inherited nonenum
Last updated
Was this helpful?