diff --git a/es6.md b/es6.md index 4ad0dec5a..58a041679 100644 --- a/es6.md +++ b/es6.md @@ -48,13 +48,9 @@ world `; ``` -### Syntax improvements +### Other improvements ```js -// Short object syntax -// aka: `exports = { hello:hello, bye:bye }` -module.exports = { hello, bye }; - // New string methods "hello".repeat(3) "hello".contains("ll") @@ -65,6 +61,35 @@ var bin = 0b1010010; var oct = 0755; ``` +### Object literal enhancements + +```js +// Short object syntax +// aka: `exports = { hello:hello, bye:bye }` +module.exports = { hello, bye }; + +App = { + // shorthand for `handler: handler` + handler, + + // methods + start() { + this.go(); + }, + + // getter/setter + get closed() { + return this.status === 'closed'; + }, + + // custom prototypes + __proto__: protoObj, + + // computed property names + [ "prop_"+n ]: 42 +}; +``` + ## Stable ([Babel]) Available via [Babel]