Question

I know I can add comments like so:

//This is a comment,
/*so is this*/

But when I do this

/**comment?*/

It has a different color in my text editor (notepad++) and I was wondering whether it has any special meaning, or if it is just a random feature of notepad++.

Here is what it looks like in the text editor:

Image of the query. Shows how the special comment is a darker shade than normal.

Was it helpful?

Solution 3

Not in JavaScript itself, but some editors will treat it like a JSDoc (https://github.com/jsdoc3/jsdoc) comment to help with autocomplete, etc.

You can also run your code through something like JSDoc to automatically generate HTML documentation for your codebase.

OTHER TIPS

No, it has not any special meaning. It's more common to use that syntax when documenting code via comments.

The Java language supports three kinds of comments:

/* text /The compiler ignores everything from / to */.

/** documentation / This indicates a documentation comment (doc comment, for short). The compiler ignores this kind of comment, just like it ignores comments that use / and */. The JDK javadoc tool uses doc comments when preparing automatically generated documentation. For more information on javadoc, see the Java tool documentation.

// text The compiler ignores everything from // to the end of the line.

Probably notepad++ identifies it with two different colors just to diversify the type of comment. for a programmer a comment may be more or less important than another :)

might seem like a silly feature, but it is not

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top