best way to clone an object code example
Example: javascript clone object
var x = {myProp: "value"};
var xClone = Object.assign({}, x);
//Obs: nested objects are still copied as reference.
var x = {myProp: "value"};
var xClone = Object.assign({}, x);
//Obs: nested objects are still copied as reference.