Comments like in any other computer language are used for making the code understandable ie explaining the code in simple language.
They are not executed by the javascript.
There are two ways to enter the comments
1. Single line ie after //
2. Multi line ie between /* and */
example:
// Change heading:
document.getElementById("myH").innerHTML = "My First Page";
In this "Change heading" will not be executed.
and
/*
The code below will change
the heading with id = "myH"
and the paragraph with id = "myP"
:this is under comments
*/
document.getElementById("myH").innerHTML = "My First Page";
document.getElementById("myP").innerHTML = "My first paragraph."
0 Comment(s)