ES6 允许按照一定模式,从数组和对象中提取值,对变量进行赋值,这被称为解构。
let [a, b] = [1, 2] // a = 1, b = 2 let [a, b, c = 100] = [1, 2]
let {hello, world} = {hello: 1, world: 2} let {hello = 1, world} = {world: 2} let {hello:w, world} = {world: 2}