February 2006
Intermediate to advanced
826 pages
63h 42m
English
Sometimes it is helpful to make notes for yourself to keep track of what is going on in a script. As in HTML, JavaScript allows you to make comments in your code but offers a few different ways to do it. The first style of comment uses two forward slashes:
// this is a comment
This type of comment makes the interpreter ignore the remainder of the line. The second method allows you to comment out multiple lines:
/* this is a multi-line
or block comment */Apart from using comments to make notes to yourself, they are also quite useful in the debugging process: if you can’t seem to figure out where an error is coming from, you can comment out a line or section of the code to see if it is the culprit.