Javascript Comments

comments are added to make source code easier for humans to understand.Comments will explain what is going on.It is used to add information about the code, Compiler and interpreter don’t test the comment line.
Types of JavaScript Comments,

JavaScript have two types of comments.

  • Single-line Comment
  • Multi-line Comment

Single line comment :-

// it is used for single line comment

<script>

//document.write(“single line comment”);

<script>

Browser, will not print any thing ,Because line is commented.

Multi-line Comment :-

it is start with /* and end with */.

the text between /* and */ will be avoid by JavaScript Enabled browser.

<script>

/*

document.write(“JavaScript is very Easy Language”); alert(“Hello hi how you”);

*/

</script>




Follow Us

Contact Us

tutorialworldin@yahoo.com

Back to Top