# 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>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://deemolover.gitbook.io/log-os/main/programming-languages/javascript/import-and-export.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
