const {}
state ={
girls:1,
guys:2,
women:3,
women:4
}
const {girls, guys, women, men} = state;
Is the same as
const girls = state.girls;
const guys = state.guys;
const women = state.women;
const men = state.men;
Spread syntax
展开语法(Spread syntax),扩展运算符是三个点(...)。用于取出参数对象的所有可遍历属性,然后拷贝到当前对象之中
https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Spread_syntax
网友评论