I am trying to learn how different .js
files can be included in a HTML
file, so that my code becomes more modular. I am following this page Can we call the function written in one JavaScript in another JS file?. I am confused at one point, that if I include files like this:
<script language="javascript" src="a.js">
<script language="javascript" src="b.js">
If a.js
contains:
function alertOne() {
alert("one");
}
and b.js
contains:
function alertTwo() {
alert("two");
}
then do I need to separately call the functions in HTML file or just including the files like <script language="javascript" src="b.js">
this, would execute alertTwo()
function?