JavaScript Comments
JavaScript Tutorial » JavaScript Comments
Comments are usually used with the purpose of providing extra information, to explain JS code, and to make it more readable and also can be used to prevent execution of alternative JS code.
JS support single line and multiline comments.
Single Line Comments - example
Single line comments start with // and text between // and the end of the line will be ignored by JS
<!DOCTYPE html>
<html>
<body>
<h1 id="my_title"></h1>
<p id="my_paragraph"></p><script>
</body>
// this is my comment line Change heading:
document.getElementById("my_title").innerHTML = "My Title - JavaScript Comments";
// This is another coment line Change paragraph:
document.getElementById("my_paragraph").innerHTML = "My paragraph using JS code.";
</script>
</html>
Multi-line Comments - example
Multi-line comments is starting with /* and end with */, text between /* and */ will be ignored by JS code.
<!DOCTYPE html>
<html>
<body>
<h1 id="my_heading"></h1>
<p id="my_paragraph"></p><script>
</body>
/*
The JS code will change
the heading with id = "my_heading"
and the paragraph id = "my_paragraph"
*/
document.getElementById("my_heading").innerHTML = "My title - JavaScript Comments";
document.getElementById("my_paragraph").innerHTML = "My paragraph with JS code.";
</script>
</html>
JavaScript Comments documentation, best practices, multiline, convention, standards, function, standard, code
JavaScript Comments documentation, best practices, multiline, convention, standards, function, standard, code
JavaScript Comments - javascript tutorial
This tool makes it easy to create, adjust, and experiment with custom colors for the web.

Magnews2 is a modern and creative free magazine and news website template that will help you kick off your online project in style.

Find here examples of creative and unique website layouts.

Find here examples of creative and unique website CSS HTML menu.