Update javascript-shallow-deep-clone.md

Fixes #9
This commit is contained in:
Angelos Chalaris
2020-09-22 09:14:51 +03:00
committed by GitHub
parent 36309c3ca8
commit 4aa177e119

View File

@ -39,7 +39,7 @@ Both of these solutions showcase an example of shallow cloning, as they will wor
```js
let obj = { a: 1, b: { c: 2 } };
let clone = JSON.parseJSON.stringify(obj));
let clone = JSON.parse(JSON.stringify(obj));
clone.b.c = 4;
// obj = { a: 1, b: { c: 2 }}, clone = { a: 1, b: { c: 4 } }
```