export
Keyword
export Keyword
The export
declaration is used to export values from a JavaScript module. Exported values can then be imported into other programs with the import
declaration or dynamic import. The value of an imported binding is subject to change in the module that exports it - when a module updates the value of a binding that it exports, the update will be visible in its imported value.
In order to use the export
declaration in a source file, the file must be interpreted by the runtime as a module. In HTML, this is done by adding type="module"
to the <script>
tag, or by being imported by another module. Modules are automatically interpreted in strict mode.