Object Copies in JavaScript
Let's learn how to copy objects. For example, let's say we have some object:
let obj = {a: 1, b: 2, c: 3};
Let's make a copy of it. This is done using a special method, like this:
let copy = Object.assign({}, obj);
There is also a second approach - via destructuring:
let copy = {...obj};