DEV Community

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

Collapse
 
4rontender profile image
Rinat Valiullov

In console I have: "Uncaught SyntaxError: Unexpected token." (row#2 => job.company:...)

function es6({ age, name, job.company: company}) {
var yearOfBirth = 2018 - age,
console.log(
${ name } works at ${ company } and was born in ${ yearOfBirth }.);
}

Collapse
 
peril profile image
Erica DiGiulio

That's because of the comma at the end of the assignment.