revive let blocks

Axel Rauschmayer axel at rauschma.de
Thu Jun 18 14:31:25 UTC 2015


> On 18 Jun 2015, at 15:59 , Bradley Meck <bradley.meck at gmail.com> wrote:
> 
> (a=1)=>{
>   console.log(a)
> }()
> 
> Is less verbose than an IIFE and keeps `this` the same. Also keeps the initialization and init of the variable in the same place.


Neat trick. Caveat – you need parentheses around the arrow function:

```js
((a=1)=>{
  console.log(a)
})();
```

-- 
Dr. Axel Rauschmayer
axel at rauschma.de
rauschma.de



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150618/078d6234/attachment.html>


More information about the es-discuss mailing list