Why is "export default var a = 1;" invalid syntax?

Glen Huang curvedmark at gmail.com
Wed May 6 05:33:13 UTC 2015


The point is to keep the binding:

```js
export default let a = 1;
a = 2;
``` 
exports value 2

```js
let a = 1
export default a;
a = 2;
```
exports value 1

> On May 6, 2015, at 1:18 PM, Bucaran <jbucaran at me.com> wrote:
> 
> Read as much as I could, but it was getting too long, so just to quickly summarize:
> 
> While you can’t:
> 
> 
> ```js
> export default let a = 1
> ``` 
> 
> 
> You certainly can:
> 
> 
> ```js
> let a = 1
> export default a
> ```
> 
> Or 
> 
> ```js
> let a = 1
> let b = 2
> let c = 3
> 
> export default {
> A: a,
> B: b,
> C: c
> }
> ```
> 
> Cheers
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss



More information about the es-discuss mailing list