Commenting is the most important part of any programming language. Have you ever written a program or a script in the past and if you try to see that code now, will you be able to remember what is going on in the code?
Probably you forgot to do what all other programers forget to do, and that is to write the meaning of full code which you have written.
When you are writing any code, may be you are writing some complex logic, some important formula which is confusing, and that is the perfact situation/time to write some meaningful comment for that code, so later when you try to understand or modify that code you can easily recognise the purpose of that code and why you have written that.
In other case it's not always necessary that only you will modify your code later, it may happen that later someone else may modify the code which you have written, so that is very usefull to know for them that why you have written that code. Another thing for debugging purpose also you can put some unimportant code into comment to skip the execution.
/* This code will be used value from setting table and and mutliply by with the transaction table so the result can be different for each salesman. */ var salesmanPercentage = "Some value from setting table based on candidateid"; var salesmanSale = "Salesman sale from the transaction table"; var salesmanCommission = salesmanPercentage * salesmanSale;