Can anyone explain to me what this Javascript syntax accomplishes? Tried Googling for it, but I don't know how to form my query. Any help would be appreciated.
const {
assign,
create,
defineProperties,
defineProperty,
freeze,
getOwnPropertyDescriptor,
getOwnPropertyNames,
getPrototypeOf,
hasOwnProperty,
isFrozen,
keys,
seal,
setPrototypeOf,
} = Object;
const { bar } = foo; // where foo = { bar:10, baz:12 };
/* This creates a constant with the name 'bar', which has a value of 10 */
({ a, b } = { a: 10, b: 20 });
console.log(a); // 10
console.log(b); // 20
Reference: