Question #115

Author: admin
tags: JavaScript  
html:
<script type="module" src="main.js"></script>
main.js:
console.log('start');
import './module1.js';
console.log('middle');
import './module2.js';
console.log('end');
module1.js:
console.log('module1');
module2.js:
console.log('module2');
In what order will the text be printed to the console?
start, module1, middle, module2, end
start, middle, end, module1, module2
start, middle, end
module1, module2, start, middle, end
When executing code in the module mode, the javascript interpreter first looks for all imports in the code and executes the code of each imported module once.
Rate the difficulty of the question:
easyhard