对象clone
Object.prototype.clone = function(){ var o = this.constructor === Array ? [] : {} for(var e in this){ o[e] = typeof this[e] == 'object' ? this[e].clone() : this[e] } return o } let a = { a: [1, 2], b: { a:[2,3] } } let b = a.clone() console.log(b)