A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://webplatform.github.io/docs/javascript/statements/Comment below:

Comment · WebPlatform Docs

Comment Summary

Causes comments to be ignored by the JavaScript parser.

Syntax
Single-line Comment:
// comment

Multiline Comment:
/*
comment
*/

Comments with conditional compilation:
//@CondStatement
/*@
condStatement
@*/
Examples

The following example illustrates the most common uses of comments.


 function myfunction(arg1, arg2){
     var r;
     
     r = arg1 + arg2
     return(r);
 }

The following example shows how to use conditional compilation. This example uses special comment delimiters that are used only if conditional compilation is activated by the @cc_on statement. Scripting engines that do not support conditional compilation see only the message that says conditional compilation is not supported.


 
     alert("Conditional compilation not supported by this scripting engine.");
 
Remarks

The comment argument is the text of any comment you want to include in your script. The condStatement argument is to be used if conditional compilation is activated. If single-line comments are used, there can be no space between the “//” and “@” characters.

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

If single-line comments are used, the parser ignores any text between the comment marker and the end of the line. If multi-line comments are used, the parser ignores any text between the beginning and end markers.

Comments 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 single-line or multi-line comments respectively.

Attributions

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4