import & export
export 将一个文件中定义的变量、函数、类导出,使得其他文件可以调用;其他文件可以使用 import 来导入其他文件导出的变量、函数、类。(import 应该是新语法,传统用法是通过 require 导入一个模块)
Reference
[1] https://developer.mozilla.org/en-US/docs/web/javascript/reference/statements/export
[2] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import
Last updated
Was this helpful?