Coding Terms | COMMENTS

EDDYMENS
Coding Terms
Published in
Mar 8, 2022
Photo by Artur Shamsutdinov on Unsplash

Definition

A comment is a text written close to any piece of code to better describe what it does to other developers.

Use cases and Examples

1 var count = 0;
2 for(var i = 0; i<10; i++) {
3 count++;
4 }
5 console.log(count); // count is 10;

Line 5 of the Javascript code above has a comment ie: count is 10 which tells the reader what the output of the console log statement will be.

Summary

Sometimes a developer can take commenting too far, where they rather choose to comment on a poorly written code instead of just fixing it.

Originally published at https://codingterms.com.

--

--