suggestions and make the program more readable for developers.
Comments can also be used to prevent the execution of certain code lines. This is useful when testing;
It is represented by double forward slashes (
//). It can be used before and after the declaration.
<script> // It is single line comment or Inline comment document.write("Hello! UK Academe"); </script>
This example uses a single line comment at the end of each line to explain the code:
<script> var x = "Hello!"; // Declare x, give it the Text of Hello! var y = x +" UK Academe"; // Declare y, give it the Text of UK x + Academe // Write y to demo: document.getElementById("demo").innerHTML = y; </script>
/ * and
Note: It is most common to use single line comments. Block comments are often used for formal documentation.