I am looking to scope my JavaScript code by enclosing it within an anonymous function, like this:
(function() {
// All of my code goes here
})();
However, I have a page that loads JavaScript through a script tag, like this:
<script type="text/javascript" src="${jsFile}"></script>
The JavaScript loaded from that source ends up breaking my page. How can I properly enclose it to prevent this issue?
Any tips or suggestions are greatly appreciated!