Last updated 2022-11-05 03:50:45

What Is A Comment?

Table of contents


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

01: 1 var count = 0; 02: 2 for(var i = 0; i<10; i++) { 03: 3 count++; 04: 4 } 05: 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.

Here is another article you might like 😊 "Diary Of Insights: A Documentation Of My Discoveries"