ES6 - Dynamic Properties

es6

// ES6 - Dynamic properties:

We can define a property within an object using dynamic parts by wrapping it in 
square brackets:

var jack = {
  ['hello_' + (() => 'world')()]: 42
};
console.log(jack.hello_world); // 42
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License