Where it appears that our script is not running at all it usually means that there is a syntax error somewhere inside a function that is causing the script to not recognise where the function ends. We can test if a particular function is the cause of this sort of error by wrapping all of the content of the function inside a comment. If the function is supposed to be returning a value then we can temporarily add a return statement that returns a specific value that while not necessarily the one that the function will always return will at least be sufficient to allow the following code to continue running. If the script now runs then you have identified that the syntax error that is causing the script to not work is within the code that you have commented out. You can then adjust what part of the function is commented to help you narrow down which statement within that code is the actual cause of the problem.
Commenting out blocks of code can also be used to make it easier to unit test specific parts of the code.To thoroughly test a particular function within the code you might comment out all of the code in the script except for that function and then temporarily add a number of test calls to the function passing it different values and if necessary using an alert to display the value that each call returns. That way you can check that one function for lots of different alternatives without needing to run all of the rest of the script at the same time. This is particularly useful where given values into the function may seldom occur when the rest of the script runs.
Yet another use for commenting code during testing is where you are testing a script that is supposed to update something each time that it is run and where subsequent runs will therefore normally produce different results. In this situation commenting out the particular piece of the code that performs that update will allow the same test to be run over and over without your having to reset the updated value back in between tests.
The only thing that you have to be careful about if you comment out pieces of the script while testing is to make sure that you uncomment all of the code and remove any temporary statements once you complete those specific tests. You don't want those temporary changes to be the cause of errors in the script.