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

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.

主站蜘蛛池模板: 尉犁县| 镇原县| 娄烦县| 武清区| 九龙坡区| 临沂市| 乳源| 哈密市| 忻州市| 鹤峰县| 磐石市| 安多县| 德惠市| 彭州市| 沛县| 汕尾市| 商南县| 黑龙江省| 中山市| 循化| 黔江区| 玉田县| 嘉峪关市| 隆安县| 万州区| 长武县| 永德县| 双柏县| 资阳市| 连平县| 金乡县| 光山县| 玉龙| 龙川县| 家居| 凤山市| 沈丘县| 信丰县| 榆中县| 芜湖市| 五家渠市|