>
> ```js
> export var a = 1;
> a++;
> ```
> I believe the exported value is 2?
>
Well, the value isn't exported, the "binding" is. But yes, after the
module code runs, the value of the "a" export will be 2.
```js
> var a = 1;
> export default a;
> a++;
> ```
>
And this is 1?
>
The value of the "default" export after the module code runs will be 1.
> ```js
> var a = 1;
> export { a };
> a++;
> ```
> (Not sure about this one, looks like 1)
>
No - this is the same case as the first above. You are exporting the "a"
binding just like above.
> So the question is, there is no way to bind variables with the “export
> default” syntax, when it is used to export an object?
>
Not sure what you mean by "object" (I think you might be confused by the
`export {}` syntax), but you can rename your exports:
var a = 1;
export { a as b };
(Then you'd have an export named "b", instead of "a".)
And you can rename it to "default" if you like:
var a = 1;
export { a as default };
```js
> export default function a() {}
> a = 2;
> ```
>
(This should be 2, right?)
>
I *think* the "default" binding in this case would still point to the
function. I find this particular example completely baffling, to be honest.
Kevin
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss