javascript best way to copy object code example Example: copy object javascript var x = {myProp: "value"}; var y = Object.assign({}, x);