DEV Community

Discussion on: Make Your Code Cleaner, Shorter and Easier to Read! ES6 Tips and Tricks.

Collapse
 
4rontender profile image
Rinat Valiullov • Edited

You have a tiny misspelling


function foo() {
return {
name: 'Anna',
age: 56,
job: { company: 'Tesco', title: 'Manager' }
};
}
// pre ES6
let a = foo(), name = a.name, *****age = name.age*****, company = a.job.company;
// ES6 destructuring and concise parameters
let { name, age, job.company: company} = foo();

Collapse
 
samwsoftware profile image
Sam Williams

Thanks for pointing it out.