1. Deep copy cannot be correctly implemented if there are circular references in the object.

const a = {
  b:1
}
a.c=a
console.log(JSON.parse(JSON.stringify(a)))
Copy the code

Parse json. stringify and json. parse will result in time as a stringif there is a time object in data. Not a time object.

const a = {
  b:new Date(1231478256728)
}
console.log(JSON.parse(JSON.stringify(a)))
Copy the code

3. If RegExp or Error objects are present in data, the serialized result will only get empty objects.

Const a = {b: new RegExp(/\d/), c: new Error(' Error ')} console.log(json.parse (json.stringify (a)))Copy the code

4, if there is a function in data, undefined, then the result of serialization will set the function to undefined or lost;

const a = {
    b: function (){
        console.log(1)
    },
    c:1,
	d:undefined
}
console.log(JSON.parse(JSON.stringify(a)))
Copy the code

If the data contains NaN, Infinity, and -infinity, the serialized result becomes NULL

Const a = {b: NaN, c: 1.7976931348623157E+10308, d: + 1.7976931348623157E+10308,}Copy the code