标签:code java asc bsp define too 允许 指定 efi
var [a=1,b=2,c=4] = [11,34,55];
console.log(a,b,c);//11 ,34,55
let [x,,y]=[12,23,45];
console.log(x,y);//12,45
let [d,...t]= [12,13,14,15,16];
console.log(`d:${d} t:${t}`);//d:12 t:13,14,15,16
let [u,i,...r] = ["q"];
console.log(u,i,r);//q undefined []
解构赋值允许指定默认值。
let [foo = ‘hello‘]=[];
console.log(foo);//hello
let [bar = ‘how‘,too= ‘world‘] =[‘teach‘];
console.log(bar,too); //teach world
let [sh = 2] = [undefined];
console.log(sh);//2
let [de = 1] = [null];
console.log(de);//null
标签:code java asc bsp define too 允许 指定 efi
原文地址:http://www.cnblogs.com/SunShineM/p/7491081.html