Comments are nothing more than text that does not display in the browser window. It’s useful to understand what code is written for what purpose.Comments are useful for conveying messages in any programming language. Used to add code information, warnings, or suggestions to make code easier to interpret by end users or other developers.
Comments in JavaScript are no different from comments in other programming languages and are ignored by the JavaScript engine.
JavaScript supports two different types of comments:
Single-line Comment:
As the name suggests, single-line comments can only stop the execution of a single line.Single-line comments start with two forward slashes (//) and continue until the end of the line:
Example: