I am writing a HTML page that loads two js files. The two js files both use function a(), so I guess that if I can create the third js file and throw same function a() into that file, the browser might load faster because it doesn't have to load the same function twice. So can somebody tell me if I am on the right track about this, and how to load functions from different js file?
Thank you!
How to X?isn't yes or no. Perhaps you mean "don't do that"?function f(){...}defined (globally) in two different files) are redefined for all files -- this often leads to unintended behavior, i.e. bugs; (3) if code is to be reused or play well with other code, use custom objects and/or anonymous functions to avoid polluting the global name space.