destructuring assignment

JSoperatorassignment ⟩ destructuring

⭐️ ES6 (2015)

in a destructuring assignment,

  • right-hand side: an array / object (a “structured” value)

  • left-hand side: specifies one or more variable names using a syntax that mimics array / object literal syntax.

// destructuring assignment
let {a} = {a: 1, b: 2};
let [a, b=0, , ...rest] = iterable;

Last updated