But I tough that javascript could also be written in a separate .js file, later included in .html page, not only in head and body tags. | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 1

But I tough that javascript could also be written in a separate .js file, later included in .html page, not only in head and body tags.

31st Jul 2016, 1:13 PM
Andrea
Andrea - avatar
3 Respuestas
+ 2
You're correct. Having JavaScript code in an external file is preferred especially if the same code is included in more than one HTML document.
31st Jul 2016, 2:04 PM
ZinC
ZinC - avatar
0
Sorry, there it is, external .js doc.
31st Jul 2016, 1:18 PM
Andrea
Andrea - avatar
0
javascript can be written in .js file you just have to place the file in the same folder of html and use <script src="abc.js"></script> in html (if another location mention source)
3rd Aug 2016, 1:49 AM
Anoynmous
Anoynmous - avatar