workabout

What are enhanced object literals?

Object literals make it easy to quickly create objects with properties inside the curly braces. For example, it provides a shorter syntax for common object property definition as below.

//ES6

var x = 10, y = 20

obj = { x, y }

console.log(obj); // {x: 10, y:20}

//ES5

var x = 10, y = 20

obj = { x : x, y : y}

console.log(obj); // {x: 10, y:20}