Javascript Comments

  • Comments are sentences that we can write in our JavaScript code like our notes and it would not affect our code.
  • Comments can be used for explaining code or stopping execution of some part of code.
  • Comments are ignored by JavaScript

How to write comments in JavaScript

  • For single line comments we can use two forward slashes
  • For multi-line comments we use forward slash with star (asterisk) and the close the comment by star followed by forward slash.