Using global variables is not a so clean or safe solution, instead you can use the data-X attributes, it is cleaner and safer:
<script type="text/javascript" data-parameter_1="value_1" ... src="/js/myfile.js"></script>
From myfile.js you can access the data parameters, for instance with jQuery:
var parameter1 = $('script[src*="myfile.js"]').data('parameter_1');
Obviously "myfile.is" and "parameter_1" have to match in the 2 sources ;)
Update 2024
under certain conditions, you can access it directly from the JS inside the script:
let parameter_1=document.currentScript.dataset.parameter_1;
from the reference :
It's important to note that this will not reference the
element if the code in the script is being called as a callback or
event handler; it will only reference the element while it's initially
being processed.