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

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.

主站蜘蛛池模板: 高淳县| 扬中市| 秦安县| 阿图什市| 广灵县| 竹山县| 三原县| 江门市| 浦城县| 黔东| 承德市| 贵南县| 尚义县| 桃园县| 师宗县| 蓬莱市| 福贡县| 浦县| 沂源县| 尉犁县| 如东县| 辉县市| 南丹县| 易门县| 房产| 灵川县| 宜君县| 炎陵县| 鄱阳县| 罗甸县| 米脂县| 垣曲县| 普兰店市| 醴陵市| 葫芦岛市| 榆树市| 乌什县| 乌恰县| 德昌县| 龙川县| 丹寨县|