官术网_书友最值得收藏!

Comments

One last thing for this chapter: comments. Inside your JavaScript program, you can put comments. These are ignored by the JavaScript engine and don't have any effect on how the program works. But, they can be invaluable when you revisit your code after a few months, or transfer the code to someone else for maintenance.

Two types of comments are allowed:

  • Single line comments start with // and end at the end of the line.
  • Multiline comments start with /* and end with */ on the same line or any subsequent line. Note that any code in between the comment start and the comment end is ignored.

Some examples are as follows:

// beginning of line

var a = 1; // anywhere on the line

/* multi-line comment on a single line */

/*
  comment that spans several lines
*/

There are even utilities, such as JSDoc and YUIDoc, that can parse your code and extract meaningful documentation based on your comments.

主站蜘蛛池模板: 金湖县| 吉安县| 博爱县| 星子县| 沂源县| 德安县| 中山市| 上思县| 宜昌市| 吉林市| 龙海市| 辽阳市| 拉萨市| 色达县| 红桥区| 古蔺县| 甘南县| 新竹县| 康马县| 石门县| 宁海县| 章丘市| 富源县| 阿巴嘎旗| 兴和县| 西平县| 二连浩特市| 石景山区| 高州市| 中阳县| 黄浦区| 滕州市| 博白县| 克拉玛依市| 海南省| 灯塔市| 开鲁县| 无极县| 阿拉善右旗| 抚远县| 鄂伦春自治旗|