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

Glen Huang curvedmark at gmail.com
Wed May 6 05:49:56 UTC 2015


This is syntax error. export is only allowed in the top level.

> On May 6, 2015, at 1:45 PM, Bucaran <jbucaran at me.com> wrote:
> 
> Oh, I see. I guess the following is not going to work either.
> 
> ```js
> let a = 1;
> setTimeout(() => {
>  export default ++a
> }, 100);
> ```
> 
>> On May 6, 2015, at 2:41 PM, Glen Huang <curvedmark at gmail.com> wrote:
>> 
>> let a = 1;
>> setTimeout(() => a = 2, 100);
>> export default a;
> 



More information about the es-discuss mailing list