×

Html & Html5

The World's best Software Development Study Portal

JS Comments


Generally comments are meant for the ease of reading the code for the code readers and these comments are ignore by the browser.It is mostly for the other programmer who is also working on the same project.
And it generally makes the code easy to understandable and it also avoid the unnecessary code.

Types of Javascript comments


Mainly we are having two types of Javascript comments , these are as follows:-

  • Single-line comment
  • Multi-line comment

Let's understand them one-by-one

<!DOCTYPE html>

<html>

<head>

<style>

// This is a single-line comment

p {

      text-align: center;

      color: blue;

}

/* This is

a multi-line

comment */

</style>

</head>

<body>

<p> Comments are helpful for the code readers.<p>

</body>

</html>


Output of the program



Comments are helpful for the code readers.


So this is how comments are implemented in a code and there is no effect at the time of giving the output.






JS training insitute | Best IT Training classes in Gurgaon | Web Designing Training Institute