ES6 learning(入门)第二记
解构赋值解构赋值的写法数组赋值let [a, b, c] = [10, 20, 30];
console.log(a, b, c);let [x, y, ...other] = [1, 2, 3, 4, 5];
console.log(x, y, other);对象赋值let {name, age} = {name: 'fmujie', age: 18};
console.log(name, age);函数赋值function test() {
return [10, 20];
}
let [num1, num2] = test();
console.log(num1, num2);函数参数名指定function test({x=3, y=3}) {
return x + y;
}
console.log(test());
console.lo...