Concepts

Own-field selection

Try the free JavaScript compiler

Require own fields for an explicit record contract; inherited properties do not satisfy the contract.

Formal Syntax & Structure

javascript syntaxjavascript
Object.hasOwn(record, key)

Working Example

Example Snippetjavascript
(async () => {const x=Object.create({theme:"dark"});x.name="A";console.log(x.theme,Object.hasOwn(x,"theme"),Object.hasOwn(x,"name"));})()
JavaScript Reference