Object.createintermediate// Create an object with a specific prototype
const proto = { greet() { return 'hi' } }
const child = Object.create(proto)
child.greet() // β 'hi'Use Object.create() to create a new object with a specific prototype, enabling prototype-based inheritance.
Properties on the prototype are accessible via the created object even though they are not own properties. in finds them but Object.keys and hasOwnProperty do not.
Challenge: Implement canAccessInherited(proto, key) that creates an object with proto as its prototype and returns whether the key is accessible (using the in operator).
canAccessInherited({ role: 'admin' }, 'role') // β true
canAccessInherited({ role: 'admin' }, 'age') // β false