You are here

13 May 2017

The Object.assign() method copies all properties from one or more source objects to a target object. It returns the target object. This can be used for cloning an object in ES6, just create an empty object and copy the properties to it. The first object, the empty object in our case, will be returned.

Source code viewer
  1. var clone = Object.assign({}, obj);
Programming Language: ECMAScript