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

Comments

One last thing for this chapter: comments. Inside your JavaScript code 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
  • Multi-line 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 will be ignored.

Some examples:

// 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, that can parse your code and extract meaningful documentation based on your comments.

主站蜘蛛池模板: 荥经县| 泸定县| 东港市| 邵东县| 格尔木市| 沙雅县| 竹北市| 措勤县| 荆州市| 枣强县| 新龙县| 获嘉县| 承德县| 辰溪县| 灵宝市| 镇远县| 同心县| 乌什县| 太和县| 班戈县| 阿荣旗| 南漳县| 怀安县| 乐平市| 普定县| 巴楚县| 海原县| 彰化市| 和硕县| 互助| 长宁县| 金沙县| 新化县| 明溪县| 逊克县| 清流县| 台安县| 柯坪县| 托克逊县| 商水县| 桦川县|