ES6 Object Literal Features in Depth (Ponyfoo)

In notebook:
Article Notes
Created at:
2016-01-05
Updated:
2016-01-05
Tags:
JavaScript Fundamentals
ES6 Object Literal Features in Depth

Use computed property names:

  var foo = 'bar'
var baz = { [foo]: 'ponyfoo' }
console.log(baz)

Infer property names:

  function getItem(){//...}
function setItem(){//...}
function clear(){//...}
module.exports = { getItem, setItem, clear }

Method definitions

  var foo = {
    baz () {
        // foo.baz()
    }
}
of course there's already ​get​ and ​set​