Articles → JavaScript → Comments in JavaScript

Single line comments

    // This is a single line comment.

Multiline comments

	    This is a multiline comment .
      In this  you can write any no.of lines.

    <title>Comments example</title>
    <script language="JavaScript">
	    Code added by : GyanSangrah
	    Code added on : September 13, 2010		
	function ClickMe()
		// This piece of code will fire an alert.	
		// It is important to add semi colon  at the end to avoid 
		// any javascript error.
        alert("Hi, this is a comments sample");			

    <input type="button" name="btnComments" value="Click Me" onclick="javascript:ClickMe();">

Posted By  -  Karan Gupta
Posted On  -  Tuesday, December 28, 2010


Your Email Id  
Query/FeedbackCharacters remaining 250