Comments can be used to explain JavaScript code. It is used to add
information about the code, warnings or suggestions so that end user can easily
interpret the code.The JavaScript comment is ignored by the JavaScript engine .
Types of Comments
:
- Single Line comments
- Multiline comments
Single Line comment
<script type="text/javascript">
// This is a single line JavaScript comment
</script>
|
Multiline comment
<script type="text/javascript">
/*document.write("hi!");
document.write("hi!");
document.write("hi!");
document.write("hi!");
document.write("hi!");
document.write("hi ");
*/
</script>
|