数组解构赋值
[a,b]=[1,2];
方法返回
function f(){
return [1,2]
}
let a,b;
[a,b]=f();//a=1,b=2
 
function f1(){
return [1,2,3,4,5]
}
let a,b;
[a,b]=f();//a=1,b=2
 
[a,,...b]=f1();//a=1;b=[3,4,5]
 
对象解构赋值
 
{a,b=1}={a:1,b:2}
 
 
 
 
05-06 17:25