The simplest way, if it's just a single property, is not to use destructuring:
let bar = obj.foo;
If you want to use destructuring (perhaps you have several properties), though, give the name of the property, a colon, and the name of the variable/constant:
let {foo: bar} = obj;
Example:
const obj = {
foo: 'bar'
};
let {foo: bar} = obj;
console.log(bar);
Remember that object destructuring syntax exactly mirrors object initializer syntax. In an object initializer, foo: bar assigns the value from bar to the property foo:
const obj = {foo: bar}; // Property `foo` is assigned the value from variable `bar`
So in object destructuring, foo: bar assigns the value of the property foo to the variable bar:
let {foo: bar} = obj; // Variable `bar` is assigned the value from property `foo`
let { foo: bar } = obj;:D Basically, LHS syntax is copied from RHS syntax, so no special stuff likeas. more destructuring secrets