Deep and Shallow Copy with Object.assign JavaScript

Mayank Gupta
TechnoFunnel
Published in
3 min readSep 13, 2020

--

Working with JavaScript Object.assign Function

Deep and Shallow Copy in JavaScript with Object.assign, Cloning Data in JavaScript, Copy Data in JavaScript
Deep and Shallow Copy in JavaScript with Object.assign

TechnoFunnel presents another article focussed on Cloning an Object using Object.assign Function in JavaScript. Object.assign is another great way to copy the object into some other Object. We will look whether we can perform Deep or Shallow Copy using this method.

For other Methods of copying Object, you can refer to the following:

What is Object.assign in JavaScript

Object.assign is used to copy the key value pair of one object to another. Lets look for the below code to understand the working of this keyword.

--

--

Mayank Gupta
TechnoFunnel

9 Years of Experience with Front-end Technologies and MEAN Stack. Working on all Major UI Frameworks like React, Angular and Vue https://medium.com/technofunnel