change object without changing the main object in javascript code example
Example 1: set variable to object without editing old object js
var newObject = jQuery.extend(true, {}, myObj);
//requires jquery
Example 2: set variable to object without editing old object js
// [Object1]<--------- myObj
const tempMyObj = Object.assign({}, myObj);
// [Object1]<--------- myObj
// [Object2]<--------- tempMyObj