Home > Web Front-end > Front-end Q&A > Are the values ​​output by the es6 module copied?

Are the values ​​output by the es6 module copied?

青灯夜游
Release: 2022-10-18 15:29:56
Original
1143 people have browsed it

No, the ES6 module outputs a reference to the value, while the CommonJS module outputs a copy of the value. In the ES6 module, when the JS engine statically analyzes the script and encounters the module loading command import, it will generate a read-only reference; when the script is actually executed, it will go to the loaded module based on this read-only reference. Take value. ES6 modules are dynamic references. ES6 modules do not cache running results, but dynamically obtain values ​​from the loaded module, and variables are always bound to the module in which they are located.

Are the values ​​output by the es6 module copied?

## The operating environment of this tutorial: Windows 7 system, ECMAScript version 6 , Dell G3 computer.


Browser loading

By default, the browser

loads JavaScript scripts synchronously, that is, when the rendering engine encounters It will stop when it reaches the

Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template