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

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.

主站蜘蛛池模板: 涿鹿县| 丽江市| 宁南县| 巴塘县| 琼结县| 东兰县| 垦利县| 大名县| 青神县| 天水市| 蓝山县| 东安县| 寿光市| 沙坪坝区| 通城县| 原平市| 漳浦县| 万载县| 大厂| 旺苍县| 漠河县| 渝中区| 秦皇岛市| 罗平县| 普安县| 禹城市| 安宁市| 南溪县| 温宿县| 阳高县| 德州市| 高安市| 嘉祥县| 高陵县| 麟游县| 保亭| 曲松县| 四会市| 临澧县| 奈曼旗| 静海县|