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

JS深拷贝 | Davis #24

Open
lvzero535 opened this issue Feb 27, 2021 · 0 comments
Open

JS深拷贝 | Davis #24

lvzero535 opened this issue Feb 27, 2021 · 0 comments

Comments

@lvzero535
Copy link
Owner

https://lvdongfeng.vip/2021/02/27/JS%E6%B7%B1%E6%8B%B7%E8%B4%9D/#more

当你想修改某个数据但又不影响原来的数据时就需要对原数据进行拷贝。JS来说,基本数据的赋值是基于值的没啥影响,但是对象的赋值是基于地址的,这就有影响,具体可以看下JS的数据存储。 浅复制浅复制,只复制第一层,更新深层的还是基于地址的赋值,如数组[].concat(origin); origin.slice();对象Object.assgin({}, origin)这个简单,不多说。 深拷贝先来说

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

No branches or pull requests

1 participant