javaScript comment

The text / code lines of javaScript are used to comment it is not displayed in the web page to the user, the web developer gives the comment for themselves in the source code, in this the description of the code (Explanations) can be given which read the source code. This helps in understanding and therefore developers use the comment.

1 javascript Single line comment

Symbol of double forward slash (//) is placed next to the text / code lines in javaScript that have to be commented.

Syntax

//-----------

2 javascript Multiple line comment

Symbol of asterisk (*) and forward slash (/) is placed at the end of forward slash (/) and asterisk (*) and text / code lines to comment two or more text / code lines in javaScript.

Syntax

/*

------------

------------

*/

Example 1

<!DOCTYPE html>

<html>

<head>

<title></title>

</head>

<body>

<script>

//single line comment Example

document.write("single line comment Example ");

</script>

<br>

<script>

/* multiline comment example multiline comment example */

document.write("multiline comment example");

</script>

</body>

</html>

Output

single line comment Example
multiline comment example


Connect with us

facebook logo
Email : contact@amcodestar.com
© Copyright amcodestar.com 2020 - 2023 All Rights Reserved.
About us     term and condition      comment policy
DMCA.com Protection Status