Why object literals in JavaScript are cool

Before ECMAScript 2015 object literals (also named object initializers) in JavaScript were quite elementary. It was possible to define 2 types of properties: Pairs of property names and related values { name1: value1 } Getters { get name(){..} } and setters { set name(val){..} } for computed property values Sadly, the object literal possibilities match into a single example: Try in JS Bin var myObject = { myString: 'value 1', get myNumber(… Continue reading