Where you want better control over the script changes and don't mind having to manually edit the HTML of the pages that reference the script you can incorporate a version number into the file name of the script. Then by simply updating the references in the HTML to point to the new version you make sure that the latest version of the script will be downloaded when your visitors pick up the updated version of the page.
This same approach can be used where you want to be able to dynamically replace scripts at set time intervals during a visit to the page. You could use this technique to switch the particular file that contains the script to be run between two (or more) alternative versions of the same function. I can't see any particular use for this since a simpler solution would be to give the two functions different names and include them in the same script and then simply change which function gets called rather than swapping out the entire script but this did make it easier to test the functionality of the script to ensure that it will work for reloading the same script at specified intervals without having to actually modify the script quickly between calls.
This article written by Stephen Chapman, Felgall Pty Ltd.