All terms


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.


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

All terms