I have some inline JavaScript on several different pages like this:
$(function() {
var myVar1 = ...;
var myVar2 = ...;
var myVar3 = ...;
function myFunc1() {
...
}
function myFunc2() {
...
}
if (blah blah) {
myFunc1();
}
else {
myFunc2();
}
});
I would like to move them into an external script, which is the recommended way of deploying client-side JavaScript.
However, for each individual page, I have a different value for variable myVar1, so it seems like I have to create multiple very similar JS files because of this tiny difference. Is there any better way?