Javascript object literal: what exactly is {a, b, c}?

var f = {a, b, c};

It came with ES6 (ECMAScript 2015) and means exactly the same as:

var f = {a: a, b: b, c: c};

It is called Object Literal Property Value Shorthands (or simply property value shorthand, shorthand properties).

You can also combine shorthands with classical initialization:

var f = {a: 1, b, c};

For more information see Property definitions in Object initializer.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)