Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【Q757】如何解决深拷贝问题中的循环引用 #813

Open
shfshanyue opened this issue Apr 14, 2024 · 1 comment
Open

【Q757】如何解决深拷贝问题中的循环引用 #813

shfshanyue opened this issue Apr 14, 2024 · 1 comment
Labels

Comments

@shfshanyue
Copy link
Owner

例:

const o = { a: null }

o.a = o
@shfshanyue shfshanyue added the js label Apr 14, 2024
@echoustintian
Copy link

正常的深拷贝,加一个 Map 记录深拷贝时遍历的属性值,如果两个属性值重复了且这个属性值为引用,那么就不去遍历这个对象的属性

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants