Confessions and Confusions of a Freelance Fullstacker.

Ashok Mannolu Arunachalam, Smart codingJS

Smart coding: destructuring in JavaScript

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:

const Person = {
name: 'AshKeys',
blog: ''
const { name, blog } = Person
console.log(`${name} - ${blog}`)

Isn't this lovely! \O/

We can do the same for arrays as well.

const [max, min] = [80, 20]
console.log(`Min - ${min}; Max - ${max}`)

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