How to Write Comments in JavaScript?

Learn how to write comments that will help you remember what code you wrote and why you wrote it that way.

We often place comments in our code so that we know what it is doing.

JavaScript is similar to C++ and Java in its commenting style:

  • Everything between /* and */ is ignored by the interpreter.
  • Everything after // on the same line is ignored by the interpreter.

Get hands-on with 1200+ tech skills courses.