JS Basic Tutorial
In JavaScript, comments are used to write notes, explanations, or temporarily disable parts of code. Comments are ignored by the JavaScript engine during execution, making them useful for improving code readability and documentation.
There are two types of comments in JavaScript:
Single-line comments start with //
. Everything after //
on that line will be treated as a comment
Try it yourself
Multi-line comments start with /*
and end with */
. They can span multiple lines and are useful for longer explanations or to comment out blocks of code.
Try it yourself