🈯export
🚧 under construction
JS ⟩ grammar ⟩ declaration ⟩ export
(directive or declaration❓)
Every module can have two different types of export, named export and default export. You can have multiple named exports per module but only one default export.
export { PI, TAU }; // named exports
export default class SomeClass { ... } // default export
Export declarations are not subject to temporal dead zone rules. You can declare that the module exports X
before the name X
itself is declared.
export { x }; // export before declaration (it's OK)
const x = 1;
Last updated
Was this helpful?