You can also specify the name of the file itself, as jQuery does:
<script src='myScript-v1-2.js'>
Then each time you revise the script, you click on the version number and change the pages containing it to indicate the name of the new script. It is safe and cached, but it still allows your viewers to get the maximum benefit from caching and does not require server configuration changes for the .js file.
A complete solution typically involves setting a relatively short caching time for your host web page, and then allowing various resources (style files, JS files, images, etc.) to have longer caching periods for maximum caching. Anything with fingerprints can have a very long cache life. See the link fabianhjr posted about ways to set the host web page cache lifetime. This can be done on the web page itself ( <meta> settings) or in the http headers through the server.
If you turn off caching for your script file (which probably should be done at the web server level for the script file), then all your viewers will lose their caching advantage and you will lose bandwidth and memory savings when caching. If you use a common .JS file on many pages (a common design template), your viewers will see slower performance on each page.
source share