• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Hour 3. How JavaScript Programs Work > Workshop: Using Comments

Workshop: Using Comments

In Hour 2, you used HTML comments to hide your script from older browsers. JavaScript also includes its own type of comments. While these won't hide JavaScript from anyone or anything, they are useful for their intended purpose—commenting on your script.

Comments allow you to include documentation within your script. This will be useful if someone else tries to understand the script, or even if you try to understand it after a long break. To include comments in a JavaScript program, begin a line with two slashes, as in this example:


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint