What\'s the difference between this two code examples (besides the syntax of course)?
var user = { name: \'Diego\', age: 25 } var
There's no effective difference, but destructuring is convenient:
var user = { name: 'Diego', age: 25 } var {name, age} = user;
That declares and initializes both name and age in one statement without redundant mentions of the property names.
name
age