assign ( target: Object , sources: Object ) { Object }

Properties in the target object are overwritten by properties in the sources if they have the same key. Later sources' properties overwrite earlier ones. The Object.assign() method only copies enumerable and own properties from a source object to a target object. It uses [[Get]] on the source and [[Set]] on the target, so it will invoke getters and setters. Therefore it assigns properties, versus copying or defining new properties. This may make it unsuitable for merging new properties into a prototype if the merge sources contain getters. For copying property definitions (including their enumerability) into prototypes, use Object.getOwnPropertyDescriptor() and Object.defineProperty() instead. Both String and Symbol properties are copied. In case of an error, for example if a property is non-writable, a TypeError is raised, and the target object is changed if any properties are added before the error is raised.

Parameters
Name Type Description
target Object

what to apply the sources’ properties to, which is returned after it is modified.

sources Object

objects containing the properties you want to apply.

Returns

The target object.

create ( proto: Object , propertiesObject: Object ) { Object }

Creates a new object with the specified prototype object and properties

Parameters
Name Type Description
proto Object

The object which should be the prototype of the newly-created object

propertiesObject Object

If specified and not undefined, an object whose enumerable own properties (that is, those properties defined upon itself and not enumerable properties along its prototype chain) specify property descriptors to be added to the newly-created object, with the corresponding property names. These properties correspond to the second argument of Object.defineProperties().

Returns

A new object with the specified prototype object and properties

defineProperty ( obj: Object , prop: String , descriptor: Object ) { Object }

Adds the named property described by a given descriptor to an object.

Parameters
Name Type Description
obj Object

The object on which to define the property.

prop String

The name or Symbol of the property to be defined or modified.

descriptor Object

The descriptor for the property being defined or modified.

Returns

The object that was passed to the function

entries ( obj: Object ) { Array }

Returns an array containing all of the [key, value] pairs of a given object's own enumerable string properties.

Parameters
Name Type Description
obj Object

The object whose own enumerable string-keyed property [key, value] pairs are to be returned.

Returns

An array of the given object's own enumerable string-keyed property [key, value] pairs.

freeze ( obj: Object ) { Object }

Freezes an object. Other code cannot delete or change its properties.

Parameters
Name Type Description
obj Object

The object to freeze.

Returns

The object that was passed to the function.

fromEntries ( iterable: Array ) { Object }

Returns a new object from an iterable of [key, value] pairs. (This is the reverse of Object.entries).

Parameters
Name Type Description
iterable Array

An iterable such as Array or Map or other objects implementing the iterable protocol.

Returns

A new object whose properties are given by the entries of the iterable.

getOwnPropertyDescriptor ( obj: Object , prop: String ) { Object }

Returns a property descriptor for a named property on an object.

Parameters
Name Type Description
obj Object

The object in which to look for the property.

prop String

The name or Symbol of the property whose description is to be retrieved.

Returns

A property descriptor of the given property if it exists on the object, undefined otherwise

getOwnPropertyDescriptors ( obj: Object ) { Object }

Returns an object containing all own property descriptors for an object.

Parameters
Name Type Description
obj Object

The object for which to get all own property descriptors

Returns

An object containing all own property descriptors of an object. Might be an empty object, if there are no properties.

getOwnPropertyNames ( obj: Object ) { Array }

Object.getOwnPropertyNames() returns an array whose elements are strings corresponding to the enumerable and non-enumerable properties found directly in a given object obj. The ordering of the enumerable properties in the array is consistent with the ordering exposed by a for...in loop (or by Object.keys()) over the properties of the object. The ordering of the non-enumerable properties in the array and the ordering among the enumerable properties is not defined.

Parameters
Name Type Description
obj Object

The object whose enumerable and non-enumerable properties are to be returned.

Returns

An array of strings that corresponds to the properties found directly in the given object.

getOwnPropertySymbols ( obj: Object ) { Array }

Similar to Object.getOwnPropertyNames(), you can get all symbol properties of a given object as an array of symbols. Note that Object.getOwnPropertyNames() itself does not contain the symbol properties of an object and only the string properties. As all objects have no own symbol properties initially, Object.getOwnPropertySymbols() returns an empty array unless you have set symbol properties on your object.

Parameters
Name Type Description
obj Object

The object whose symbol properties are to be returned.

Returns

An array of all symbol properties found directly upon the given object.

getPrototypeOf ( obj: Object ) { Object }

The Object.getPrototypeOf() method returns the prototype (i.e. the value of the internal [[Prototype]] property) of the specified object.

Parameters
Name Type Description
obj Object

The object whose prototype is to be returned.

Returns

The prototype of the given object. If there are no inherited properties, null is returned.

is ( value1: Any, value2: Any) { Boolean }

The Object.is() method determines whether two values are the same value.

Parameters
Name Type Description
value1 Any

The first value to compare

value2 Any

The second value to compare.

Returns

A Boolean indicating whether or not the two arguments are the same value.

isExtensible ( obj: Object ) { Boolean }

Objects are extensible by default: they can have new properties added to them, and (in engines that support __proto__ their __proto__ property) can be modified. An object can be marked as non-extensible using Object.preventExtensions(), Object.seal(), or Object.freeze().

Parameters
Name Type Description
obj Object

The object which should be checked.

Returns

A Boolean indicating whether or not the given object is extensible.

isFrozen ( obj: Object ) { Boolean }

An object is frozen if and only if it is not extensible, all its properties are non-configurable, and all its data properties (that is, properties which are not accessor properties with getter or setter components) are non-writable.

Parameters
Name Type Description
obj Object

The object which should be checked.

Returns

A Boolean indicating whether or not the given object is frozen.

isSealed ( obj: Object ) { Boolean }

Returns true if the object is sealed, otherwise false. An object is sealed if it is not extensible and if all its properties are non-configurable and therefore not removable (but not necessarily non-writable).

Parameters
Name Type Description
obj Object

The object which should be checked.

Returns

A Boolean indicating whether or not the given object is sealed.

keys ( obj: Object ) { Array }

Object.keys() returns an array whose elements are strings corresponding to the enumerable properties found directly upon object. The ordering of the properties is the same as that given by looping over the properties of the object manually.

Parameters
Name Type Description
obj Object

The object of which the enumerable's own properties are to be returned

Returns

An array of strings that represent all the enumerable properties of the given object.

defineProperties ( obj: Object , props: Object ) { Object }

Object.defineProperties, in essence, defines all properties corresponding to the enumerable own properties of props on the object obj object.

Parameters
Name Type Description
obj Object

The object on which to define or modify properties.

props Object

An object whose keys represent the names of properties to be defined or modified and whose values are objects describing those properties. Each value in props must be either a data descriptor or an accessor descriptor; it cannot be both (see Object.defineProperty() for more details).

Returns

The object that was passed to the function.