Answers for "javascript duplicate objects"

8

copy object javascript

// es6
const obj = {name: 'john', surname: 'smith'};
const objCopy = {...obj};
Posted by: Guest on April-09-2020
1

javascript clone object

var x = {myProp: "value"};
var xClone = Object.assign({}, x);

//Obs: nested objects are still copied as reference.
Posted by: Guest on April-27-2020

Code answers related to "javascript duplicate objects"

Code answers related to "Javascript"

Browse Popular Code Answers by Language