03. Object Destructing
const {key1, key2} = {key1:…, key2…}const { width: w, height: h, title } = options;const { a = 1, b = 0, z: c = 3 } = { b: 2, z: undefined };
const [d = 0, e = 5, f = 6] = [4, , undefined];
return a === 1 && b === 2 && c === 3 && d === 4 && e === 5 && f === 6;const { width: w = 100, height: h = 200, title } = options;const FOO = "foo";
const { [FOO]: f } = { foo: 123 }; // f = 123// Create and destructure a property whose key is a symbol
const KEY = Symbol();
let obj = { [KEY]: "abc" };
let { [KEY]: x } = obj; // x = 'abc'Last updated