题解 | #简易深拷贝#
简易深拷贝
https://www.nowcoder.com/practice/3d436d07f5cb4b628a4dd7c12476cabe
const _sampleDeepClone = target => {
if (typeof target != 'object' || !target) return target
let constructor = target.constructor
let result = new constructor()
for (let key in target) {
if (target.hasOwnProperty(key)) {
result[key] = _sampleDeepClone(target[key])
}
}
return result
}

