Before ES6, the community developed some module loading solutions, mainly including CommonJS and AMD. The former is used for servers, and the latter is used for browsers. In terms of language specifications, ES6 implements module functions and is quite simple to implement. it can completely replace the existing Com... before ES6, the community developed some module loading solutions, mainly including CommonJS and AMD. The former is used for servers, and the latter is used for browsers. ES6 implements module functions in terms of language specifications and is quite simple to implement. it can completely replace the existing CommonJS and AMD specifications and become a common module solution for browsers and servers.
Modules (module)
Each ES6 module is a file containing JS code. the module is essentially a script, rather than defining a module with the module keyword. By default, all modules run in strict mode. The module function consists of two commands: export and import. The export command is used for user-defined modules and defines external interfaces. the import command is used to enter functions provided by other modules and create namespaces to prevent function name conflicts.
Export
Export is used to export functions and objects from a given file (or module.
The above is a detailed description of ES6's new feature development applet (7). For more information, see other related articles in the first PHP community!