There are no "external" or "internal" JavaScript files. Here is how they work: you include a sequence of
<script> … <script>
elements in your HTML. Some include JavaScript inside the tag (instead of '…'), some reference files external to this HTML. And these fragments on JavaScript are processed in sequence
as it was one bigger JavaScript file.
Therefore, the question makes no sense. But the code style looks really bad. You can do something like
var myData = {
DEFAULT_URL: 'sampletext.pdf',
DEFAULT_SCALE_DELTA: 1.1,
MIN_SCALE: 0.25,
DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT: 5000 }
var myResult = someFunction(myData);
function someFunction(data) {
var scale = data.DEFAULT_SCALE_DELTA;
scale +=
if (scale > data.MIN_SCALE)
scale = data.MIN_SCALE;
return result;
}
In the code shown above, each declaration can be in a separate file, but you should not break declarations between files in an arbitrary place.
If you should have
more than one object with the
same properties as
myData
,
you should use object constructor.
—SA