JS Miscellaneous

  1. 深拷贝和浅拷贝:浅拷贝是拷贝一层,深层次的对象级别的就拷贝引用;深拷贝是拷贝多层,每一级别的数据都会拷贝出来。That is to say, if the data is a basic data type during shallow copy, it will copy itself just like direct assignment. If there is a layer of objects in addition to the basic data type, then for shallow copy, you can only copy The reference, the change of the object will be reflected on the copied object; but the deep copy will copy multiple layers, even if the object is nested, it will all be copied.

Guess you like

Origin blog.csdn.net/weixin_45879810/article/details/112943829