Rest operator is awesome. Here is how to copy properties from one object to another using Spread operator.
//copy properties from an object to another one
//using SPREAD OPERATOR.
const obj1 = {
a: 2,
b: 5
}
const obj2 = {
...obj1,
c: 6
} //{a: 2, b: 5, c: 6}
Top comments (0)