The JS file is often called foo.js or something close to that.
When you have the full URL of the .js file, some/many/all(?) http servers will let you surf the .js file as if it was an html document. As a result, you will see the full .js file in the browser.
Disclaimer: I have tried this on a few servers and it was a while ago. But the technique should probably work in most cases.
OTOH, I don't think this was what the original poster wanted to achieve.
Everything went worng, just as foreseen.