ES6 – Object literals

Hi, in ES6 we have enhanced in object literals. Es6 added some new syntax for create properties.

First if you want to read about “Object literals” in ES5 you can read my post.

In ES6 we can defining properties like this:

let a = 100, b = 200;

let myObject = { a, b };

console.log("b property --->", b);


In ES6 we can define methods with new syntax:

let myObject = {
  a: 1,
  myFunction() {
    console.log("Hi from myFunction");



Note: this ways of define method allow us to use “super” keyword inside them.

By Cristina Rojas.