[i]Learn· Grammar and types
Comments
The syntax of comments is the same as in C++ and in many other languages:
// a one line comment
/* this is a longer,
* multi-line comment
*/
You can't nest block comments. This often happens when you accidentally include a */ sequence in your comment, which will terminate the comment.
/* You can't, however, /* nest comments */ SyntaxError */
In this case, you need to break up the */ pattern. For example, by inserting a backslash:
/* You can /* nest comments *\/ by escaping slashes */
Comments behave like whitespace, and are discarded during script execution.
Note:
You might also see a third type of comment syntax at the start of some JavaScript files, which looks something like this: #!/usr/bin/env node.
This is called hashbang comment syntax, and is a special comment used to specify the path to a particular JavaScript engine that should execute the script. See Hashbang comments for more details.
example 1 of 2
[>_]Terminal
Output appears here when you press Run.
$ ▌