SQL PHP HTML ASP JavaScript articles and free scripts to download
 

Comments in JavaScript

Like other programming languages, we can use Comments within our JavaScript code to for documentation or for easy understanding. Comments can be used before or after any line of code within the code.


Note that these comments are to be used within JavaScript codes only and should not be used outside the script area or in our html areas.


Single line comments we can place comment any where by adding // before the line. Here is an example.

<script type="text/javascript">
var msg="Welcome to plus2net";
document.write(msg);
// Display message through variable
</script>

We can place comments at the end of a line also.

<script type="text/javascript">
var msg="Welcome to plus2net";
document.write(msg); // Display message
</script>

Multiline comments

Comments can be extended to multiline also. Like this .

<script type="text/javascript">
/*
The below line will display
Welcome message to all
visitors of plus2net.com
*/
var msg="Welcome to plus2net";
document.write(msg);
</script>





Francis08-04-2010
I really loved this website guys.
Post Comment This is for short comments only. Use the forum for more discussions.
Name
Email( not to be displayed)Privacy Policy
1+2=This is to prevent automatic submission by spammers. Please enter the result of the sum as asked


Join Our Email List
Email:  
For Email Newsletters you can trust