1.数组、对象的匹配赋值【解构赋值】
let [a,b,c] = [1,2,3]
// 可以用于变量值之间的转换
let a = 1;
let b = 2;
[a,b] = [b,a]
// 成功切换
let {name,age} = {name:"fanqi",age:27}; //变量名需要和对象的属性名称相对应
2.模版字符串
let a = "中国";
let b = `我是${a}人`;
3.函数默认值
function test(a,b = 2){
return a + b;
}
// 惰性求职
let b = 1;
function test(x = b + 1){
return x;
}
4.箭头函数
标签:function,ES6,return,name,总结,语法,let,test
From: https://www.cnblogs.com/fanqisoft/p/18688325