Object concepts

Own property

Try the free JavaScript compiler

A property directly on the object rather than inherited through its prototype. It may be enumerable or non-enumerable and may hold undefined.

Formal Syntax & Structure

javascript syntaxjavascript
Object.hasOwn(object, key)

Working Example

Example Snippetjavascript
console.log(Object.hasOwn({a:1},"a"),Object.hasOwn({},"toString"));
JavaScript Reference