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

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.

主站蜘蛛池模板: 肇州县| 娄底市| 望谟县| 吉林省| 孝昌县| 麻江县| 山东省| 义马市| 凌源市| 灌云县| 永清县| 盐津县| 咸宁市| 安康市| 高陵县| 慈利县| 富锦市| 满城县| 华亭县| 波密县| 绿春县| 镇平县| 县级市| 天长市| 壤塘县| 于田县| 洞头县| 尚义县| 治多县| 前郭尔| 巴彦淖尔市| 石阡县| 高陵县| 通辽市| 大丰市| 青田县| 两当县| 常熟市| 旌德县| 漳平市| 彰武县|