What is JavaScript Comment and Advantages of JavaScript comments?

What is JavaScript Comment and Advantages of JavaScript comments?

The JavaScript comments are a meaningful way to deliver the message. It is used to add information about the code, warnings, or suggestions so that the end-user can easily interpret the code.

The JavaScript comment is ignored by the JavaScript engine i.e. embedded in the browser.

Advantages of JavaScript comments

There are mainly two advantages of JavaScript comments.

1. To make code easy to understand It can be used to elaborate the code so that the end-user can easily understand the code.

2. To avoid unnecessary code It can also be used to avoid the code being executed. Sometimes, we add the code to perform some action. But after some time, there may be a need to disable the code. In such a case, it is better to use comments.

subscibe