Created
August 23, 2019 08:35
-
-
Save a-nemilov/8f23bb2f7a4414d53ce92916db133bb2 to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/xinomuz
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
const o1 = { | |
t1:{ | |
t2: { | |
t3: 1 | |
}, | |
t4: 1 | |
}, | |
t5: 1 | |
} | |
const o2 = { ...o1 }; | |
// const o2 = Object.assign({}, o1) ; | |
console.log(o1); | |
console.log(o2); | |
o2.t1.t2.t3 = 2; | |
o2.t1.t4 = 2; | |
o2.t5 = 2; | |
console.log(o1); | |
console.log(o2); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">const o1 = { | |
t1:{ | |
t2: { | |
t3: 1 | |
}, | |
t4: 1 | |
}, | |
t5: 1 | |
} | |
const o2 = { ...o1 }; | |
// const o2 = Object.assign({}, o1) ; | |
console.log(o1); | |
console.log(o2); | |
o2.t1.t2.t3 = 2; | |
o2.t1.t4 = 2; | |
o2.t5 = 2; | |
console.log(o1); | |
console.log(o2);</script></body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const o1 = { | |
t1:{ | |
t2: { | |
t3: 1 | |
}, | |
t4: 1 | |
}, | |
t5: 1 | |
} | |
const o2 = { ...o1 }; | |
// const o2 = Object.assign({}, o1) ; | |
console.log(o1); | |
console.log(o2); | |
o2.t1.t2.t3 = 2; | |
o2.t1.t4 = 2; | |
o2.t5 = 2; | |
console.log(o1); | |
console.log(o2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment