Double Slashes in Javascript

by Sanju 2012-08-28 11:08:42

Double Slashes in Javascript

In JavaScript, that means it's a comment line. As long as you have those double slashes, the line is retained and printed in the code, but is not used in the application of the script. It allows you to put in comments before a section to remind yourself of what the following does, or use it to proclaim that you're the author.

Just remember that the double slash only allows for one line of text. If you add a line without the double slashes or the line you have somehow jumps to the next line by mistake... error!

In case you're wondering, you can set apart an entire paragraph as a comment. Just start the text with this: /* and end it with this: */. Keep the star next to the text. Then you can write as many lines as you want. The browser will see it all as a comment rather than something to be played with.

You must LOGIN to add comments