Rhonda
Senior Member
Alright, so from my tutorials so far I am now on JavaScript basics. My question is about comments. To sum up what the tutorial site says on the subject, they are used to "explain the JavaScript and make the code more readable" Any other observations about this?
So, I know if you use comments before a line of code, the comments prevent the script from executing;
Single line: <script type="text/javascript">
//document.write("<h1>User defined text</h1>");
However, it also covers placing these comments after a line of code. But I don't see what this does, because the only thing that gets displayed is what is between the parentheses after "document.write"
After a line: <script type="text/javascript">
document.write("Hello"); // Write "Hello"
So, I know if you use comments before a line of code, the comments prevent the script from executing;
Single line: <script type="text/javascript">
//document.write("<h1>User defined text</h1>");
However, it also covers placing these comments after a line of code. But I don't see what this does, because the only thing that gets displayed is what is between the parentheses after "document.write"
After a line: <script type="text/javascript">
document.write("Hello"); // Write "Hello"