Include the entire script in a .js file as shown below:
This causes the browser to load the script only once, and recall it from cache should the page be reloaded or revisited.
By including the above reference, your browser will now download the code stored inside displaydate.js, and run it as if the code was physically typed onto the page. The library file does not have to be stored in the same directory as the page using it. In fact, you can even reference a library that’s on a distant domain! Like this: