If you're using a framework like AngularJS where modularity and dependency injection are first-class citizens then you're all set up. If, for whatever reason, you can't package things up in nice modules then testing can be tricky, particularly when there are dependencies involved.
I came up against this recently and my solution was to use Node.js and the excellent jasmine-node package
I wrote a very simple Node module called include
Which lets me test simple JS files with no dependencies ...
Most of the code I write is more involved than this though :)