how to clone objects js code example
Example 1: clone javascript object
let clone = Object.assign({}, objToClone);
Example 2: javascript clone object
var x = {myProp: "value"};
var xClone = Object.assign({}, x);
//Obs: nested objects are still copied as reference.