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

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.

主站蜘蛛池模板: 浦北县| 同德县| 育儿| 杭州市| 永泰县| 胶南市| 苏州市| 青河县| 孝昌县| 迁安市| 广南县| 南京市| 平和县| 曲周县| 桐城市| 贵定县| 阜宁县| 塔河县| 雅安市| 芮城县| 纳雍县| 汶上县| 锡林郭勒盟| 平塘县| 容城县| 西峡县| 攀枝花市| 盖州市| 永新县| 弋阳县| 西平县| 沾益县| 来宾市| 同心县| 五常市| 常州市| 尚志市| 乌恰县| 丁青县| 囊谦县| 什邡市|