摘要: 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、若属性是变量或表达式,需用中括 阅读全文
posted @ 2020-05-18 18:37 AllenZhang_(*^▽^*) 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 具有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. 阅读全文
posted @ 2020-05-18 18:36 AllenZhang_(*^▽^*) 阅读(118) 评论(0) 推荐(0) 编辑