Commants in JavaScript

JS - Commants
JavaScript में Comment non-executable होते हैं,comment का use additional information के लिए किया जाता हैं|
Javascript में दो प्रकार की comment दी जा सकती हैं|
  1. Single Line Comment
  2. Multiline Comment

Single Line Comment


JavaScript में single line comment के लिए //(double slashes) का use किया जाता हैं|

Syntax for Single Line Comment


<script type="text/javascript">
	//Single Line Comment;
</script>

Q :- Write a JavaScript Program for Single Line Comment.


Source Code :

<!DOCTYPE html>
<html>
<head>
<title>Single Line Comment</title>
</head>
<body>
<script type="text/javascript">
document.write("Single Line Comment"); // Print
</script>
</body>
</html>		

Output :-

Single Line Comment

Multiline Comment


JavaScript में Multiline comment के लिए /*----------*/ के बीच में लिखी जाती हैं|

Syntax for Multiline Comment


<script type="text/javascript">
	/* this is multiline comment 
		print multiline comment */
</script>

Q :- Write a JavaScript Program for Multiline Comment.


Source Code :

<!DOCTYPE html>
<html>
<head>
<title>Multiline Comment</title>
</head>
<body>
<script type="text/javascript">
document.write("Multiline comment");

/* this is multiline comment 
print multiline comment */

</script>
</body>
</html>		

Output :-

Multiline comment

Post a Comment

If you have any doubts,Please let me know

close