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

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.

主站蜘蛛池模板: 敦化市| 全椒县| 汶上县| 南澳县| 砚山县| 九寨沟县| 营山县| 五莲县| 宁海县| 宜兴市| 辽阳市| 莆田市| 台湾省| 西充县| 通城县| 承德县| 丽江市| 新竹市| 易门县| 乌审旗| 雅安市| 宜兴市| 福清市| 桑植县| 云龙县| 托克逊县| 黄浦区| 通江县| 石嘴山市| 江源县| 霍州市| 鄂托克前旗| 黔西县| 马山县| 宜城市| 永福县| 英山县| 文水县| 凌源市| 元阳县| 枣庄市|