0

I'm working on a project and I see structures like this in a lot parts of the code. My question is what is this and it actually do, since it's wrapped around with the comment marker.

/**
 *
 * @param {String} message
 */
innis
  • 370
  • 1
  • 3
  • 14
  • 3
    [JSDoc](https://devdocs.io/jsdoc/) – Pointy Oct 18 '19 at 12:18
  • have a look : https://make.wordpress.org/core/handbook/best-practices/inline-documentation-standards/javascript/ – 0xAnon Oct 18 '19 at 12:19
  • this will be treated as comment and while compiling it will be ignored . commenting any thing can be done in two ways single line using // and multiple line /*.....*/ .Comments are basically used to make the code more readable. – Ayushi Keshri Oct 18 '19 at 12:22
  • this type of comment is used for specifying the request and response object i.e which type of req you will get for your API and which type of response your api gonna send after processing req object – Shubham Tiwari Oct 18 '19 at 12:26

1 Answers1

2

As you say, this is just a block comment in general. What confuses you is a convention regarding javascript comments. Because the language is not typed, there are some comment conventions in place just to unify the way we "talk" about js code in comments. Nothing magical happens with the line

 * @param {String} message

All it says to the next developer is that this code has a parameter named message, of type string. Thats it.

Take a look for more info here, it all comes down to "how you should document js code in comments inside the js file", nothing more

MKougiouris
  • 2,821
  • 1
  • 16
  • 19