JavaScript Object.assign() Method18 Mar 2025 | 1 min read The Object.assign() method is used to copy the values of all enumerable own properties from one or more source objects to a target object. Objects are assigned and copied by reference. It will return the target object. Syntax:Parametertarget: The target object. sources: The source object(s). Return value:This method returns the target object. Browser Support:
Example 1Output: 3 5 1 2 Example 2Output: 33 5 Example 3Output: 3 5 23 1 Next TopicJavaScript Objects |
JavaScript Object.defineProperty() Method The defines a new property directly on an object and returns the object. To change the flags, we can use Object.defineProperty. We cannot change it back, because define property doesn?t work on non-configurable properties. Syntax: Object.defineProperty(obj, prop, descriptor) Parameter Obj: The Object on which to define the...
1 min read
JavaScript Object.defineProperties() Method The defines new or modifies existing properties directly on an object, and returning the object. Syntax: Object.defineProperties(obj, props) Parameter Obj: The object on which to define or modify properties. Props: An object whose own enumerable properties constitute descriptors for the properties to be defined or modified. Return: This method reruns...
1 min read
JavaScript Object.getOwnPropertySymbols() Method The Object. returns an array of all symbol properties found directly upon a given object. This method returns an empty array unless you have set symbol properties on your object. Syntax: Object.getOwnPropertySymbols(obj) Parameter obj: It is an object whose symbol properties are to be returned. Return value: This method returns...
1 min read
JavaScript Object.seal() Method The of JavaScript seals an object which ents new properties from being added to it and marks all existing properties as non-configurable. The object to be sealed is passed as an argument, and the method returns the object which has been sealed. Syntax: Object.seal(obj) Parameter: obj: It...
1 min read
JavaScript Object.values() Method The Object.values() returns an array which contains the given object's own enumerable property values, in the same order as that provided by a for...in loop. Syntax: Object.values(obj) Parameter: obj: It is the object whose enumerable own property values are to be returned. Return value: This method returns an array of...
1 min read
JavaScript Object.getPrototypeOf() Method The of JavaScript returns the prototype (i.e. the value of the internal [[Prototype]] property) of the specified object. Syntax: Object.getPrototypeOf(obj) Parameter obj: It is an object whose prototype is to be returned. Return value: This method returns the prototype of the given object. If there are no inherited properties,...
1 min read
JavaScript Object.is() Method The of JavaScript is used to determine whether two values are the same value. There is a special built-in method that compares values. Syntax: Object.is(value1, value2); Parameter value1: The first value to compare. value2: The second value to compare. Return value: This method returns a Boolean indicating whether or not...
1 min read
JavaScript Object.getOwnPropertyDescriptors() Method The Object. returns all own property descriptors of a given object. The difference between getOwnPropertyDescriptors() and getOwnPropertyDescriptor() method is that ignores symbolic properties. Syntax: Object.getOwnPropertyDescriptors(obj) Parameter obj: It is the object for which to get all own property descriptors. Return: This method returns an object which contains all own...
1 min read
JavaScript Object.create() Method The is used to create a new object with the specified prototype object and properties. We can create an object without a prototype by Object.creates (null). Syntax: Object.create(prototype[, propertiesObject]) Parameter prototype: It is the prototype object from which a new object has to be created. propertiesObject: It is...
2 min read
JavaScript Object.freeze() Method The freezes an object that ents new properties from being added to it. This method ents the modification of existing property, attributes, and values. Syntax: Object.freeze(obj) Parameter Obj: The object to freeze. Return value: This method returns the object that was passed to the function. Browser Support: Chrome 45.0 Edge 12.0 Firefox 32.0 Opera No Example 1 const object1 =...
1 min read
We request you to subscribe our newsletter for upcoming updates.
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India