Yes. If you move the contents of the script tag to a file using the path "js / main.js", then you add the script
<script src="js/main.js"></script>
after other scripts, it will be able to call functions. Inclusion of an external script is equivalent to the fact that the text from this script is embedded in the file.
Scripts can read the contents of previous scripts, so having multiple scripts on a page is similar to combining all of them into one file, which means that if you add a script to other scripts, it will be able to βseeβ everything in other
Regarding questions about rloader
rloader does lazy loading to pull out scripts when you need them.
More on lazy loading And you can find out about rloader from your site (I'm not an expert on this)
Why I do not recommend using rloader if you really only have 4 scripts on one page. Its excess. If you plan on having a much larger project, you can use it or the more popular requirejs to manage your scripts on different pages.
source share