Object.getOwnPropertyNamesbeginner// Get all own property names, including non-enumerable
const obj = { a: 1 }
Object.defineProperty(obj, 'hidden', { value: 2, enumerable: false })
Object.getOwnPropertyNames(obj) // β ['a', 'hidden']Use Object.getOwnPropertyNames() to list all own properties including non-enumerable ones, unlike Object.keys().
Inherited properties are NOT returned by Object.getOwnPropertyNames, even though they appear in for...in and with the in operator.
Challenge: Implement ownNamesOnly(obj) that returns the own property names and confirms they exclude inherited ones.
const proto = { inherited: 1 }
const obj = Object.create(proto)
obj.own = 2
ownNamesOnly(obj) // β ['own']