大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。
Jetbrains全系列IDE稳定放心使用
function deepCopy (obj, cache) {
if (cache === void 0) cache = []
if (obj === null || typeof obj !== 'object') return obj
var hit = find(cache, function (c) {
debugger
return c.original === obj
})
if (hit) return hit.copy
var copy = Array.isArray(obj) ? [] : {}
debugger
cache.push({
original: obj,
copy: copy
})
Object.keys(obj).forEach(key => {
debugger
copy[key] = this.deepCopy(obj[key], cache)
})
return copy
}
function find (list, f) {
debugger
return list.filter(f)[0]
}
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/186772.html原文链接:https://javaforall.net