1、如果被拷贝对象中的属性有时间对象的话,拷贝出来会为字符串,将不再是对象
javascript
var test = {
name: 'a',
date: [new Date(1536627600000), new Date(1540047600000)],
};
console.log(test)
console.log(JSON.parse(JSON.stringify(test)));

2、如果obj里有RegExp(正则表达式的缩写)、Error对象,则序列化的结果将只得到空对象;
javascript
const test = {
name: 'a',
date: new RegExp('\\w+'),
};
const copyed = JSON.parse(JSON.stringify(test));
test.name = 'test'
//console.error('ddd', test, copyed);
console.log(test);
console.log(copyed);

3、如果obj里有函数、undefined,则序列化的结果会把函数或 undefined丢失;
javascript
const test = {
name: 'a',
date: function hehe() {
console.log('fff')
},
b:undefined
};
// debugger
const copyed = JSON.parse(JSON.stringify(test));
test.name = 'test'
console.log('ddd', test, copyed);
4、如果obj里有NaN、Infinity和-Infinity,则序列化的结果会变成null