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

什么是浅拷贝? #48

Open
yuanye4017 opened this issue Jan 18, 2022 · 1 comment
Open

什么是浅拷贝? #48

yuanye4017 opened this issue Jan 18, 2022 · 1 comment

Comments

@yuanye4017
Copy link

文章里的例子浅拷贝就是用=赋值,但是浅拷贝指的不是指浅层次的拷贝?在第一层发生改变不会影响原有变量,是我理解错了吗?

var a = { name: 'hello' };

// 这种不是浅拷贝吗?
var b = { ...a };

// 例子说这种是浅拷贝?
var c = a;
@52HzNoBrain
Copy link

两种都叫做浅拷贝但是两种的拷贝结果还是有所不同的,具体可以了解https://blog.csdn.net/m0_61825758/article/details/131483976?spm=1001.2014.3001.5501,个人见解可以参考一下。

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

No branches or pull requests

2 participants