hasOwnProperty

A check that tells whether an object has a property itself, rather than inheriting it, even when its value is undefined.

In more detail

It distinguishes { bio: undefined } from {}, which a simple comparison with undefined cannot do. Object.hasOwn(obj, "key") is the modern, safer form.

Related terms

Taught in

References