Intermediate JavaScript
Q82 / 100

What is the hasOwn() method (ES2022)?

Correct! Well done.

Incorrect.

The correct answer is B) A static method Object.hasOwn(obj, key) that checks for own property existence, safer than hasOwnProperty()

B

Correct Answer

A static method Object.hasOwn(obj, key) that checks for own property existence, safer than hasOwnProperty()

Explanation

Object.hasOwn(obj, "key") is equivalent to Object.prototype.hasOwnProperty.call(obj, "key") but works correctly on objects with no prototype (Object.create(null)).

Progress
82/100