34,333
edits
Changes
→Multi-line Comments
*/
</pre>
In the above example everything between the /* and */ markers is considered to be a comment. Even though this content contains valid JavaScript it is ignored by the interpreter.
== Summary ==
Comments in JavaScript enable the developer to add notes about the script or ''comment out'' sections of script that should not executed by the interpreter. Comments can be single line comments (using the // marker) or multi-line (beginning with /* and ending with */).
Commenting is considered to be good practice. Regardless of how well you understand tyhe logic of some JavaScript their is a good chance you one day have to retunr to that script and modify it. Often this can be months, or even years, later and what seemed obvious at when you wrote it may seem less obvious in the future. Also, it is often likely that some other person will haver to work on your scripts in the future. For both these reasons it is a good idea to provide at least some basic amount of commenting in your JavaScript scripts.