Computer >> Computer tutorials >  >> Programming >> Javascript

How do we use single line comments in JavaScript?


The following is a single line comment in JavaScript. Any text between a // and the end of a line is treated as a comment and is ignored by JavaScript.

// This is a comment. It is similar to comments in C++

The following example showing how to use single line comments in JavaScript.

<script>
   <!--
      // This is a comment. It is similar to comments in C++
   //-->
</script>