export-javascript

杰瑞发布于2024-10-06

The export declaration is used to export values from a JavaScript module.

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.
导出声明用于从JavaScript模块导出值。然后,导出的值可以通过导入声明或动态导入导入到其他程序中。导入绑定的值会在导出它的模块中发生变化——当模块更新它导出的绑定的值时,更新将在其导入的值中可见。
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