The JavaScript comments are considered as the most meaningful way in order to deliver the messages. The JavaScript is used in order to add the additional information about the code, suggestions or warnings.
This is done in order to help the user to interpret the code very easily.
The JavaScript comments are generally ignored by the JavaScript engine i.e. it is embedded in the browser.
There are two types of comments in JavaScript.
There are many benefits of using the JavaScript Comment.
In case the case code has to be disabled then the same can be performed using the JavaScript comment. Whenever a code is required to be disabled it is always preferred to use the JavaScript comment.
The JavaScript single line comment is generally represented by double forward slashes (//) it can be used before and after the statement.
<script> // It is single line comment document.write("hello Java Portal India Pvt Ltd"); </script>
In case of multiple line comment the single line comments can be added to it without any hassle. It is more convenient to use the multiple line comment. The multiple line comment is represented using the forward slashes with an asterisk and then the asterisk is followed by a forward slash. This comment can also be used before and after the statement.
<script> /* this is startup company . Java Portal India Pvt Ltd */ document.write("example of javascript multiline comment"); </script>