×

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>

<script>

// This is a single-line comment. It will not be displayed

/* It is multi line comment.

It will not be displayed */

document.write("how are you");

</script>

</head>

<body>

</body>

</html>


Output of the program



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