Destructuring Objects

Introduction

Destructuring [JavaScript Objects](JavaScript Objects) introduced in ES6. [Rest Operator (…) in Object Destructuring](Rest Operator (…) in Object Destructuring) can also be used here.

Syntax

const saviour = { first: "Jonn", last: "Connor" };
const { f, l } = saviour;
 
console.log(saviour, f, l); // { first: 'John', last: 'Connor' } John Connor