Core JavaScript 1.5 Reference:Comments:comment
From MDC
目录 |
[编辑] 摘要
Notations by the author to explain what a script does. Comments are ignored by the interpreter. 作者用來解釋程式的功能用,不被直譯器所編輯。
| Comments | |
| Implemented in: | JavaScript 1.0, NES2.0 |
| ECMA Version: | ECMA-262 |
[编辑] 语法
// comment text
/* 多行注释文字 */
[编辑] 描述
JavaScript 支持 Java风格的注释:
- Comments on a single line are preceded by a double-slash (
//). - Comments that span multiple lines are preceded by a
/*and followed by a*/. 多行注释不能嵌套。
[编辑] 例子
[编辑] 例1: 单行注释
// This is a single line comment var intAge = 37; // This is another comment
[编辑] 例2:多行注释
/* This is a multiple-line comment. It can be of any length and you can put whatever you want here, excluding another multiple-line comment. */