Comments are annotations in the source code of a program that are ignored by the interpreter. As a result, they have no effect on how the code runs or the output it produces.

But, they can be used to explain what your code is doing to any humans that attempt to read it. Therefore, they can be incredibly useful to both others and your future self when trying to make sense of your past code.

In HTML, comments begin with <!-- and end with --> tags. Notice that there is an exclamation tag in the opening tag, but not in the closing tag.

Here's what they look like:

      <!-- Comments go in here. -->

Anything within those tags will not be displayed by the browser.

Build A Hacker News Clone
Learn how to build and deploy a full-stack, production-ready application with React.js, Node.js, and MongoDB.
View Course

They can also be used to comment out sections of code:

      <!-- Do not display the paragraph element
      <p>A paragraph element.</p>

Hopefully, this was helpful with your coding journey!