August 17, 2024
JavaScript Comment
If you want to write some notes in your JavaScript code file which you do not want to execute but want to include in your JavaScript code file for better understanding your code. So for it you can create comments in JavaScript. These comments present in your file/code but, these all will not be execute. There are two types of comments in JavaScript, single line comment and multi line comment. You can start single line JavaScript comments with // sign and you can write your text following that. And multi line JavaScript comment starts with /* and ends with */. Examples of JavaScript comments are mentioned below:
Single Line Comment
Code
<script language="JavaScript">
// comment sample
</script>
Multi line Comment
Code
<script language="JavaScript">
/*
comment sample line 1
comment sample line 2
*/
</script>