Front-end common layout and deep copy

Common layouts:

常见的布局:
(1)flex:弹性布局
收缩因子flex-shrink:默认为1
扩张因子flex-grow:默认为0
order:定义排列顺序
flex-basis:主轴空间(相当于width,权重更大)
align-self:定义单个项目在交叉轴的排列方式

(2)响应式布局:自适应

(3)流式布局(% px)

(4)静态布局(minwidth,maxwidth小于加背景,大于加滚动条)

Deep copy (for arrays and objects)

了解数据存储
栈:自动分配内存空间,系统自动释放,里面存放的是基本类型的值和引用类型的地址
堆:动态分配的内存,大小不定,也不会自动释放。里面存放引用类值
基本类型:赋值 真正的值
引用类型:赋值 引用类型的地址
深拷贝:传值
方法:数组:for循环
slice截取
concat拼接
对象:for…in
浅拷贝:传地址

WebSocket

WebSocket 是一种网络通信协议

Advantages of WebSocket

1. Reduce time-consuming and resource-consuming requests: it is a true full-duplex mode. After the connection is established, the server and the client are completely equal and can request each other, reducing unnecessary network request time loss and network traffic;

2. More persistent: After the websocket protocol establishes a TCP connection through the first request, as long as it does not actively close, it can always maintain the connection state to exchange data; 3. The server can actively send messages to the client;

Guess you like

Origin blog.csdn.net/weixin_50370865/article/details/128460283