Comments are used for following in javascript

  1. To document code. It makes code readable & easier to understand.
  2. To avoid or stop code execution while debugging a script.

Javascript comments are of two types:

  1. Single line comment
  2. Multi line comment

Single line comment

Two forward slashes without space are used to add single line comment, As its name, only single line can be commented.

<script>
// I am single line comment
</script>

Multi line comment

To comment more than one line, javascript allows multiline comment.

<script>
/* 
	I am 
	Multi line
	comment

*/
</script>