Destructuring assignment is the best one that came with latest JS features.

We can make our code look smart. Just take a look at the following:

1
2
3
4
5
6
7
8
9
10
11
const Person = {
name: 'AshKeys',
blog: 'ashokma.com'
}

const {
name,
blog
} = Person;

console.log( `${name} - ${blog}` );

Isn’t this lovely! \O/

We can do the same for arrays as well.

1
2
3
const [max, min] = [80, 20];

console.log( `Min - ${min}; Max - ${max}` );

Tip: We can swap values using the same. [a, b] = [b, a]