“Object literal” improvements

“Object literal” improvements

Abbreviated notation for variable assignments

It is known that it is possible to create properties of an object based on a variable and its value, the procedure used was as follows:

Now with the new standard we can shorten this:

ES2015

Abbreviated method definition notation

Defining an object method no longer requires the function keyword and a colon. So now instead of:

we can use the abbreviated notation:

Permitted use of computed property

With the new standard it is allowed to use computed values for properties:

And even:

Duplicate properties are no longer error

Before the ES2015 standard, the compiler returned an error if an object property was duplicated, with the new standard it is now possible: