79197658

Date: 2024-11-17 16:48:03
Score: 0.5
Natty:
Report link

One of the many ways is to use spread operator.

const obj3 = {...obj1}

You can also use Object.assing() for shallow copy.

const shallowCopy = Object.assign({}, obj1);

For more information please have a look at this.

Hope, this helps.

Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Naeem Akhtar