Concepts
Accessor descriptor
Descriptor representing getter and/or setter functions instead of a stored value. A missing getter reads as undefined; a missing setter prevents ordinary writes.
Formal Syntax & Structure
javascript syntaxjavascript
{ get: getter, set: setter, enumerable: boolean, configurable: boolean }Working Example
Example Snippetjavascript
const o={};Object.defineProperty(o,"n",{get(){return 6;}});console.log(o.n);