โญdestructuring assignment

JS โŸฉ operator โŸฉ assignment โŸฉ 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