ES6解构 发表于 2019-03-08 | 分类于 JavaScript | 阅读次数: 对象解构1234567const a = {id: 1, name: 'a1', age: 30};const {id, ccc} = a;const {name, ...ddd} = a;console.log(id); // 1console.log(ccc); // undefinedconsole.log(name); // a1console.log(ddd); // {id: 1, age: 30} 数组解构1234567const b = [1, 3, 5, 7, 9];const [, eee] = b;const [, ...fff] = b;const [, , ...ggg] = fff;console.log(eee); // 3console.log(fff); // [3, 5, 7, 9]console.log(ggg); // [7, 9] 打赏 微信支付 支付宝