Comments in JavaScript


Hi friends,

Today i learned some basics of JavaScript. Lets see how to comment in javascript.

The Single line comment is simply like as other language comments.


<html>
 <body>

 <script type="text/javascript">
 // Write a heading
 document.write("<h1>Hi My name is Tha.Su</h1>");
 // Write two paragraphs:
 document.write("<p>I have two brothers.</p>");
 document.write("<p>My native is kanchipuram.</p>");
 </script>

 </body>
 </html>

The multi-line comment example is here,

<html>
<body>

<script type="text/javascript">
/*
The code below will write
one heading and two paragraphs
*/
document.write("<h1>What’s your name?</h1>");
document.write("<p>Tell about your family.</p>");
document.write("<p>Are you from?.</p>");
</script>

</body>
</html>

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s