60
rated 0 times
[
62]
[
2]
/ answers: 1 / hits: 34914
/ 10 Years ago, mon, august 25, 2014, 12:00:00
I've seen public exports of ES6 modules done in both of the following ways:
// method 1
export var getAnswer = function () { return 'forty two'; };
// method 2
export default function () { return 'forty two'; };
- Are both of these valid?
- If so, why do they both exist?
- Are there other valid options for module exports using ES6 syntax?
I'm surprised I haven't been able to find the answer with my googlefu. I'm concerned only with ES6 modules, not CommonJS, RequireJS, AMD, Node, etc.
More From » syntax