Functions in ES6

Axel Rauschmayer axel at rauschma.de
Mon Mar 25 00:28:37 PDT 2013


A rough guide for migrating functions from ES5 to ES6 would be:

1. Function declarations --> function declarations
2. Function expressions --> arrow functions
3. IIFEs -->  blocks
4. Functions in object literals --> concise method syntax
5. Constructors --> classes
6. New: generator functions

These rules are easy to understand, with one exception: You can’t have a function declaration with lexical |this| (that is, #1 is a potential source of confusion).

Have there been ideas for this? I’m thinking arrow function declarations (but without syntactic expression-versus-declaration ambiguity).

Axel

-- 
Dr. Axel Rauschmayer
axel at rauschma.de

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130325/08f7fc13/attachment-0001.html>


More information about the es-discuss mailing list