How your JavaScript is formatted will have an impact both on how quickly it runs and also on how easy it is to locate the cause of errors during testing.
To get your script to download and run as quickly as possible in the live environment you will want the script to be as small as possible. Now this doesn't mean making any changes to the actual JavaScript code itself since the time taken by any code that will be needed to convert the script back into something that can run will offset any time saving that doing that makes through the reduction in the size of the script. What it means is that you want the size of the script reduced as much as possible without actually making any changes to the actual code. This means that you want to strip out as much of the whitespace from within the script as you can as well as all of the comments in the script except for any copyright notice. Some people refer to this as minifying the script. With appropriate compression options on your server turned on just minifying the script will make for as small a download than any more advanced compression processing would provide without the overhead of needing to convert the script back into something that can be run as JavaScript once it is downloaded. A compressed/minified script should run identically to the original copy of the script because the only change you have made is to remove all the whitespace which does nothing in the running of the script in the first place.
The one thing that you do need to be careful of here is that you do not remove any spaces that are essential to the operation of the script. If you manually remove the whitespace and comments in minifying your script then you need to rerun all of the tests after doing so in order to ensure that you haven't made any changes that generate errors. Even where you run a program or script to strip out the whitespace for you there is no 100% guarantee that the conversion of your particular script has not generated errors - that depends on what your script includes and how thoroughly the particular compression script or program was tested. So it is probably worth running at least the main tests over again using the minified version of your script just to confirm that nothing has gone wrong during compression. The chances are fairly high that if there is an error in compressing the script then the resultant syntax error will prevent the script running at all so a large amount of retesting should not be necessary.
You don't want to run all your testing on a compressed version of the script though as that makes locating errors much more difficult. For example with all the code on one line, any error that the browser reports will obviously be somewhere in that one line which doesn't help any in narrowing down where the error is located. Instead you should have all of your code nicely formatted when testing it. In fact feeding your code through a formatter may assist you in locating errors as the formatter should indent the code based on how the code itself reads rather than on how you want it to read making it far easier to spot mismatched parentheses. Also because each statement is on a line of its own with your formatted version it will be easier to narrow down the location of any errors where the browser provides the line number where it realised that there was an error.
Using a properly formatted version of your script for testing will also make it much easier to modify in order to fix errors or to add code to help you to debug the script (if you like to work that way in tracking down errors). If you use the debugger built into your browser it will make it easier to track which statement is being processed.
This means that ideally you will have two copies of your script - one nicely formatted and one compressed and will use either a program or script to convert the one into the other. Of course any formatter script can't add missing comments back in so ideally you will want to always keep that version and regenerate the compressed version whenever there are changes.
