You can add random number to a filename to ensure the newest version as well.
filename.js?34324324
Just to be accurate, you're not modifying the filename, you're adding a random field to the query string, which usually invalidates the cache. This is feasible when you're including assets (JS, CSS), less so when you are serving pages, because you wouldn't want to confuse Google into indexing multiple instances of the same page (sure, you can set a canonical meta tag, but I digress…). This trick is used in web frameworks like Ruby on Rails.