What is the difference between the script written by the js file and the script written by the < srcipt > tag?

what"s the difference between writing JavaScript code in a js file and writing code in < srcipt > < / srcipt >?
Why can I introduce other js files as require in the js file and do report an error in the < srcipt > tag
.

Feb.27,2021

browsers don't support it yet.
< script type= "module" >
import {addTextToBody} from'. / utils.js';

< / script >
write script tags this way you can use import


is no different, these are just different ways of introduction


js does not have require,es6 support for import

Menu