Tag: destructuring

0

解構賦值(Destructuring Assignment)

解構賦值是 ES6 的新特性,可以將陣列或物件中的資料取出成獨立變數。 陣列解構陣列解構強調順序,左右對照相對應的元素,右邊陣列的值即可對左邊陣列相對應的元素賦值。123456var foo = ['a', 'b', 'c'];var [one, two, three] = foo;console.log(one); // "a"console.log(two); // "b"console.lo