Javatpoint Logo
Javatpoint Logo

JavaScript Object.assign() Method

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:

Parameter

target: The target object.

sources: The source object(s).

Return value:

This method returns the target object.

Browser Support:

Chrome Yes
Edge Yes
Firefox Yes
Opera No

Example 1

Output:

3 
5
1 
2

Example 2

Output:

33 
5

Example 3

Output:

3 
5 
23 
1

Next TopicJavaScript Objects





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA