JavaScript comments is used to make the code more readable and code is easily understand by other users. JavaScript support single-line as well as multi-line comments. The comment code is not display in the web browesr.
You can add Single-line comments by using double forward slash (//) as following example.
For Example
<script>
// This is my first JavaScript program
document.write("Hello World!");
</script>
Output
You can add multi-line comments begins with a slash and an asterisk (/*) and ends with an asterisk and slash (*/) as following example.
For Example
<script>
/* This is my first program
in JavaScript */
document.write("Hello World!");
</script>
Output
