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

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.

主站蜘蛛池模板: 京山县| 三都| 柳河县| 玛纳斯县| 涟源市| 黄梅县| 西城区| 贵定县| 长白| 卢湾区| 新津县| 岗巴县| 武定县| 曲水县| 花莲市| 尉犁县| 英超| 澄迈县| 苗栗县| 工布江达县| 嘉义县| 闽清县| 临沧市| 左权县| 中江县| 广汉市| 巴彦淖尔市| 长白| 陆川县| 合肥市| 罗源县| 安吉县| 新余市| 黄陵县| 青海省| 小金县| 东方市| 桐乡市| 余庆县| 木里| 开江县|