Snippet

The following function returns two variables: a credentials object and a transport string.

function getEmailConfig() {
    let credentials = {
        userName: 'anthony',
        password: 'pass'
    };
    let transport = 'smtp';
    return { credentials, transport };
}

When this function returns, the destructuring assignment feature allows you to assign the return value to two different variables in a single operation, like so:

let { credentials, transport } = getEmailConfig();

A very nice feature in ES6.

Looking for a job?
JP/Morgan Chase
Dallas, Texas

Groundswell Cloud Solutions
Vancouver, Canada

Accenture
New York

Startup (stealth)
London, UK


Related
Dynamically combining multiple OrderBy clauses in LINQ
In Angular what is the difference between ngRoute and ui-router
What exactly does import and export do in JavaScript?
Tip: assignments in ES6 vs ES5
Differences between e.preventDefault(), e.stopPropagation(), and return false;