java script comment code example

Example 1: javascript comment

//This is a javascript single line comment

/*
And here is a
multiline comment
*/

Example 2: comment in javascript

// single line comment 

/* multiline comemnt 
line 2
line 3
line 4 */

Example 3: js comment

//This does not effect the code.
var something = "But this does effect the code!";

Example 4: comment out in javascript

<script type="text/javascript">
<!--
// This is a single line JavaScript comment

document.write("I have comments in my JavaScript code!");
//document.write("You can't see this!");
//-->
</script>

Example 5: javascript comment

// Change heading:

document.getElementById("myH").innerHTML = "My First Page";


// Change paragraph:

document.getElementById("myP").innerHTML = "My first paragraph.";