Visit Mozilla.org

Core JavaScript 1.5 Reference:Comments:comment

From MDC


Contents

[edit] Summary

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

[edit] Syntax

// comment text

/* multiple line comment text */

[edit] Description

JavaScript supports Java-style comments:

  • Comments on a single line are preceded by a double-slash (//).
  • Comments that span multiple lines are preceded by a /* and followed by a */. Multiple-line comments may not be nested.

[edit] Examples

[edit] Example: Single line comment

// This is a single line comment
var intAge = 37;   // This is another comment

[edit] Example: Multiple line comment

/* 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. */