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

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.

主站蜘蛛池模板: 监利县| 屏东市| 东乡族自治县| 绵阳市| 阿克陶县| 延庆县| 视频| 若尔盖县| 江陵县| 常熟市| 禹城市| 安平县| 南开区| 夏津县| 昌吉市| 四会市| 新巴尔虎左旗| 河西区| 慈利县| 西平县| 杭州市| 贺州市| 达拉特旗| 宜阳县| 大邑县| 定陶县| 社会| 邓州市| 华亭县| 弋阳县| 息烽县| 杂多县| 循化| 兴山县| 佛坪县| 安泽县| 庐江县| 宜兴市| 新邵县| 深州市| 博野县|