0

Why in JavaScript I can't write <script src="script.js">alert("Hello")</script>

Does if I put external file in src I can't write something between script tag??? Why is that so???

25th Dec 2019, 7:35 AM
Arseniy Launce
Arseniy Launce - avatar
3 ответов
+ 4
you're right. such features are spelled out in the specification. either an external script or an internal script. the advantage is outside
25th Dec 2019, 7:49 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 3
You can use another script tag in which src is not mentioned. Or you can use import modules in javascript file. There is always good to have external js file. But it is more good have different modules in separated files
25th Dec 2019, 11:54 AM
🇮🇳Vivek🇮🇳
🇮🇳Vivek🇮🇳 - avatar