JavaScript Comment

Advertisements

Prev Tutorial Next Tutorial

Comment in JavaScript

Comment is nothing but it is a statement which is not display on browser window. it is useful to understand the which code is written for what purpose.

Comments are useful in every programming language to deliver message. It is used to add information about the code, warnings or suggestions so that the end user or other developer can easily interpret the code.

Types of JavaScript Comments

There are two types of comments are in JavaScript

  • Single-line Comment
  • Multi-line Comment

Single-line Comment

It is represented by double forward slashes //. It can be used before any statement.

Example JavaScript Comment

<script>  
// It is single line comment  
document.write("Hello Javascript");  
</script>  

Result

Multi-line Comment

It can be used to add single as well as multi line comments.
It is represented by forward slash / with asterisk * then asterisk with forward slash.

Example JavaScript Comment

<script>  
/* It is multi line comment.  
It will not be displayed */  
document.write("Javascript multiline comment");  
</script>  

Result


Prev Tutorial Next Tutorial

Google Advertisment

Buy This Ad Space @$20 per Month, Ad Size 600X200 Contact on: hitesh.xc@gmail.com or 9999595223

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

For Projects 9999595223

Google Advertisements


Buy Websites 9999595223

Buy College Projects with Documentation Contact on whatsapp 9999595223. Contact on: hitesh.xc@gmail.com or 9999595223 Try this Keyword C++ Programs

Advertisements