You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: JS/JS-br.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -595,11 +595,11 @@ let newObj = JSON.parse(JSON.stringify(obj))
595
595
console.log(newObj)
596
596
```
597
597
598
-
If an object is circularly referenced like the above example, you'll find the method `JSON.parse(JSON.stringify(object))` can't make a deep copy of this object:
598
+
Se um objto e uam referencia circular como o exemplo acima, voce vai encontrar o metodo `JSON.parse(JSON.stringify(object))`ele nao pode fazer a copia profunda desse objeto:
When dealing with function or `undefined`, the object can also not be serialized properly.
602
+
Quando lidando com uma funcao ou `undefined`, o objeto pode nao ser serializado adequedamente.
603
603
```js
604
604
let a = {
605
605
age:undefined,
@@ -610,7 +610,7 @@ let b = JSON.parse(JSON.stringify(a))
610
610
console.log(b) // {name: "yck"}
611
611
```
612
612
613
-
In above case, you can see that the method ignores function and`undefined`.
613
+
No caso acima, voce pode perceber que o metodo ignora a funcao e`undefined`.
614
614
615
615
Most often complex data can be serialized, so this method can solve most problems, and as a built-in function, it has the fastest performance when dealing with deep copy. Certainly, you can use [the deep copy function of `lodash` ](https://lodash.com/docs#cloneDeep) when your data contains the above three cases.
0 commit comments