JS: Object Literal Expression vs Object.Create
Object Literal Expression vs Object.Create
{key:val}
is equivalent to
Object.create(
Object.prototype,
{key:
{value:val,
enumerable: true,
configurable: true,
writable: true}})
// check equivalence of object literal and Object.create const xx = { "kk": 1 }; const yy = Object.create( Object.prototype, { "kk": { value: 1, enumerable: true, configurable: true, writable: true } }, ); console.log(Reflect.getPrototypeOf(xx) === Reflect.getPrototypeOf(yy)); console.log(Object.isExtensible(xx)); console.log(Object.isExtensible(yy)); console.log( JSON.stringify(Object.getOwnPropertyDescriptor(xx, "kk")) === JSON.stringify(Object.getOwnPropertyDescriptor(yy, "kk")), );
JavaScript. Object and Inheritance
- JS: Object Tutorial
- JS: Object Overview
- JS: Object Type
- JS: Test is Object Type 📜
- JS: Determine Type of Object
- JS: Prototype and Inheritance
- JS: Prototype Chain
- JS: Object.prototype.isPrototypeOf
- JS: Get Set Prototype
- JS: Show Prototype Chain 📜
- JS: Prototype Tree
- JS: Dot Notation and Prototype Chain
- JS: Create Object
- JS: Object Literal Expression
- JS: Object.create
- JS: Object Literal Expression vs Object.Create
- JS: Create Object with Parent X
- JS: Prevent Adding Property
- JS: Deep Copy Array or Object 📜
- JS: Test Equality of Array and Object by Content 📜
- JS: Add Method to Prototype
- JS: Object (class)
- JS: Object Constructor
- JS: Object.prototype