JS: Object Constructor
The purpose of Object(arg)
is to convert a Primitive Value to a Object Type.
new Object(arg)
-
equivalent to
Object(arg)
. Object(value)
-
Return a object, by converting value to a object version of value.
Object()
-
Return a empty object. Same as
{}
.
// conversion of value to object console.log(Object()); // {} console.log(Object(null)); // {} console.log(Object(undefined)); // {} console.log(Object(true)); // [Boolean: true] console.log(Object(3)); // [Number: 3] console.log(Object(3n)); // [BigInt: 3n] console.log(Object("x")); // [String: 'x'] console.log(Object({})); // {}
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: 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