Search code examples
javascriptcomments

In JavaScript does /** have any special meaning?


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.


Solution

  • 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.