摘要:
let [a, b] = [1, 2] let c = { a, b, [a + b]: a * b, d () { console.log(1) } } console.log(c) Object { 3: 2, a: 1, b: 2, d: d() } 注意: 1、若属性是变量或表达式,需用中括 阅读全文
摘要:
具有Iterator接口的数据都可以解构赋值 数组的解构赋值 let arr = [1, 2, 3, 4] let [a, , c] = arr console.log(a, c) 1 3 let [a = 1, ...b] = [undefined, 2, 3, 4, 5, 6] console. 阅读全文