clone function javascript code example
Example 1: javascript clone object
var x = {myProp: "value"};
var xClone = Object.assign({}, x);
//Obs: nested objects are still copied as reference.
Example 2: js clone element
// Syntax:
let newClone = node.cloneNode([deep])
// Example:
let p = document.getElementById("para1")
let p_prime = p.cloneNode(true)