84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
Ask when to use JSON.parse(JSON.stringify(data))
Generally used to deep copy a json object, it can also be used to remove attributes whose values do not have JSON representation (numbers, strings, logical values, arrays, objects, null), that is to say attributes like undefined and function value.
a: { age: 1, name: undefined, time: () => {...} } 变成: b: { age: 1 }
Objects can be copied
Two usage scenarios:1. Convert JSON string to JSON object, JS direct attribute reference2. Clone object
Generally used to deep copy a json object, it can also be used to remove attributes whose values do not have JSON representation (numbers, strings, logical values, arrays, objects, null), that is to say attributes like undefined and function value.
Objects can be copied
Two usage scenarios:
1. Convert JSON string to JSON object, JS direct attribute reference
2. Clone object