🎗️ TODO: ==Complete this!== It's not done!
The Object constructor` creates an object wrapper.
[toc]
⛽ YMMV: Depending on what markdown editor you use, you may have mermaid features or not. Mermaid also doesn't have proper UML notation for abstract and static properties and methods. For now, static features (which should be underlined) end with a dollar sign and abstract features (which should be italic) end with an asterisk.
classDiagram
Function <|-- Object
class Function
class Object {
+Number length$ = 1
+Object prototype$
+Object assign()$
+Object create()$
+Object defineProperty()$
+Object defineProperties()$
+Array entries()$
+freeze()$
+Object fromEntries(kvarr : Array)$
+Object getOwnPropertyDescriptor()$
+Array getOwnPropertyDescriptors()$
+Array getOwnPropertyNames()$
+Array getOwnPropertySymbols()$
+getPrototypeOf()$
+Boolean is()$
+Boolean isExtensible()$
+Boolean isFrozen()$
+Boolean isSealed()$
+Array keys()$
+preventExtensions()$
+seal()$
+setPrototypeOf()$
+Array values()$
+Object constructor
+Boolean hasOwnProperty()
+Boolean isPrototypeOf()
+Boolean propertyIsEnumerable()
+String toLocaleString()
+String toString()
+String valueOf()
}
// Object initializer or literal
{ [ nameValuePair1[, nameValuePair2[, ...nameValuePairN ]]] }
// Called as a constructor
new Object([value])- nameValuePair1, nameValuePair2, ...nameValuePairN
- Pairs of names (strings) and values (any value) where the name is separated by the value by a colon.
- value
- Any value
The Object constructor creates an object wrapper for the given value.
When called in a non-constructor context, Object behaves identical to new Object().
Object.length- Has a value of
1. Object.prototype- Allows the addition of properties to all objects of type
Object.
Object.assign() : Object- Copies the values of all enumerable own properties from one or more source object to a target object.
Object.create() : Object- Creates a new object with the specified prototype object and properties.
Object.defineProperty()- Adds the named property described by a given descriptor to an object.
Object.defineProperties()- Adds the named properties described by the given descriptors to an object.
Object.entries(kvobj : Object) : Array- Returns an array containing all the
[key, value]pairs in a given object's own enumerable string properties. Object.freeze(obj : Object) : Object- Freezes an object. Other code cannot delete or change its properties.
Object.fromEntries(kvarr : Array) : Object- Return a new object from an iterable of
[key, value]pairs.(The reverse ofObject.entries().) Object.getOwnPropertyDescriptor()- Returns a property descriptor for a named property or an object.
Object.getOwnPropertyDescriptors() : Object- Returns an object containing all own property descriptors for an object.
Object.getOwnPropertyNames() : Array- Return an array containing the names of all the given object's own enumerable and nonenumerable properties.
Object.getOwnPropertySymbols() : Array- Returns an array of all symbol properties found directly upon a given object.
Object.getPrototypeOf()- Returns the
prototypeof the specified object. Object.is() : Boolean- Compares if two values are the same value. Equates all
NaNvalues (which differ from both Abstract Equality Comparison (==) and Strict Equality comparison (===)). Object.isExtensible() : Boolean- Determines if extending of an object is allowed.
Object.isFrozen() : Boolean- Determines if an object was frozen.
Object.isSealed() : Boolean- Determines if an object is sealed.
Object.keys(kvobj : Object) : Array- Returns an array containing the names of all the given object's own enumerable string properties.
Object.preventExtensions(obj : Object) : Object- Prevents an extensions of an object.
Object.seal(obj : Object) : Object- Prevents other code from deleting properties of an object.
Object.setPrototypeOf()- Sets the object's prototype (its internal
[[Prototype]]property.) Object.values(kvobj : Object) : Array- Returns an array containing the values that correspond to all of a given object's own enumerable string properties.
Object.prototype.constructor : Object- Specifies the function that creates an object's prototype.
Object.prototype.hasOwnProperty() : Boolean- Return a boolean indicating whether an object contains the specified property as a direct property of that object and not inherited through the prototype chain.
Object.prototype.isPrototypeOf() : Boolean- Returns a boolean indicating whether the object this method is called upon is in the prototype chain of the specified object.
Object.prototype.propertyIsEnumerable() : Boolean- Return a boolean indicating if the internal ECMAScript
[[Enumerable]]attribute is set. Object.prototype.toLocaleString() : String- Calls
toString() Object.prototype.toString() : String- Returns a string representation of the object.
Object.prototype.valueOf() : String- Returns the primitive value of teh specified object.
There isn't any method in an Object itself to delete its own property (such as Map.prototype.delete()). To do so, one must use the delete operator.
🎗️ TODO: How?
The following examples store an empty Object object in o:
let o = new Object();
let o = new Object(undefined);
let o = new Object(null);The following examples store Boolean objects in o:
let o = new Object(true); // equivalent to o = new Boolean(true);
let o = new Object(Boolean()); // equivalent to o = new Boolean(false);