Comment Statements
This page is specific to:.NET Framework Version:1.12.03.03.54.0
JScript .NET
Comment Statements

Causes comments to be ignored by the JScript parser.

Syntax 1

Single-line comment:

// comment 

Syntax 2

Multiline comment:

/*
comment
*/ 

The comment is the text of any comment you want to include in your script.

Syntax 3

Single-line conditional comment:

//@CondStatement 

Syntax 4

Multiline conditional comment:

/*@
condStatement
@*/ 

The condStatement argument is conditional compilation code to be used if conditional compilation is activated. If Syntax 3 is used, there can be no space between the "//" and "@" characters.

Remarks

Use comments to keep parts of a script from being read by the JScript parser. You can use comments to include explanatory remarks in a program.

If Syntax 1 is used, the parser ignores any text between the comment marker and the end of the line. If Syntax 2 is used, it ignores any text between the beginning and end markers.

Syntaxes 3 and 4 are used to support conditional compilation while retaining compatibility with browsers that do not support that feature. These browsers treat those forms of comments as syntaxes 1 and 2 respectively.

Example

The following example illustrates the most common uses of the comment statement.

function myfunction(arg1, arg2){
   /* This is a multiline comment that
      can span as many lines as necessary. */
   var r = 0;
   // This is a single line comment.
   r = arg1 + arg2; // Sum the two arguments.
   return(r);
}

Requirements

Version 1

See Also

Conditional Compilation | Conditional Compilation Variables | @cc_on Statement | @set Statement

© 2009 Microsoft Corporation. All rights reserved.   Terms of Use | Trademarks | Privacy Statement
Page view tracker
Rate the Lightweight library
x
Lightweight builds on ScriptFree (loband) by adding features you've requested: a SearchBox and default code language selection.
Do you like the SearchBox?
Do you like the tabbed code blocks?
How useful is this topic?
Tell us more.
Thanks
x
You're helping to improve MSDN Online.
Feedback
Switch View
Classic
Lightweight Beta
ScriptFree
Switch View