object destructuing code example
Example 1: javascript function destructuring
function f() {
return [1, 2];
}
let a, b;
[a, b] = f();
console.log(a); // 1
console.log(b); // 2
Example 2: js object destructuring
const { [propName]: identifier } = expression;