I don't think it was related to nesting. Anyway, I wrote to him something
similar to what I wrote here and later he agreed. Thanks for confirming.
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss
Is it possible that Crock meant export declarations should be restricted to
the *top level* of the file? In other words, they can't be nested in
conditional blocks or inside functions, but they can appear anywhere in the
outermost scope of the module?
If so, that's effectively what ECMAScript
>
> ```js
> export default myConst;
> const myConst = {};
> ```
> would throw because when the export is evaluated
Correct, if you wanted to export `myConst` as the default without that
issue, you'd want to do
```
export {myConst as default};
const myConst = {};
```
to declaratively expose the
Douglas Crockford said that eventually JSLint would require exports at the
top of the file. However I think there are some issues.
If my understanding is correct,
```js
export default myConst;
const myConst = {};
```
would throw because when the export is evaluated, in step 2 of the
Evaluation
4 matches
Mail list logo