Post by rubina9898 on Dec 25, 2023 3:22:39 GMT
In the vast majority of cases commented code fragments are simply unnecessary. I consider arguments such as "maybe it will be useful someday" to be completely misplaced. Nowadays it is standard to use version control systems . Git even for small or private projects. Thanks to version control systems we have access to the history of changes in the project which allows us to go back to any change and recover a deleted code fragment.
Translating the obvious I can understand comments explaining the obvious if they are written by a person who is just learning the basics. At the very Phone Number List beginning of your programming adventure even such basic structures as conditions or loops may seem complicated. Then leaving an explanatory comment may even be advisable. However as you progress and develop your skills the number of such comments should tend to zero. Useful comments.
There are quite a few situations in which adding a comment to the code is useful. After all if comments didn't apply there would be no point in having such a mechanisms an API that allows you to prepare documentation for JavaScript code. In JSc comments are usually added directly above the documented code where the business purpose of the documented code return values and input parameters and their types when documenting methods are described. c also allows you to generate prepared documentation in the form of HTML code. The documentation using JSDoc for the code from earlier in the post looks like this.
Translating the obvious I can understand comments explaining the obvious if they are written by a person who is just learning the basics. At the very Phone Number List beginning of your programming adventure even such basic structures as conditions or loops may seem complicated. Then leaving an explanatory comment may even be advisable. However as you progress and develop your skills the number of such comments should tend to zero. Useful comments.
There are quite a few situations in which adding a comment to the code is useful. After all if comments didn't apply there would be no point in having such a mechanisms an API that allows you to prepare documentation for JavaScript code. In JSc comments are usually added directly above the documented code where the business purpose of the documented code return values and input parameters and their types when documenting methods are described. c also allows you to generate prepared documentation in the form of HTML code. The documentation using JSDoc for the code from earlier in the post looks like this.