javascript icon indicating copy to clipboard operation
javascript copied to clipboard

Multiline comments

Open thomasttvo opened this issue 1 year ago • 3 comments

The multiline comment section says all multiline comments need to use the jsdoc syntax /** */. Is this right? Does the author mean "All jsdoc comments" instead of "multiline"?

Otherwise, it doesn't really make sense if we use jsdoc where we're not documenting a variable, class, or function

/** 
 * This function does XYZ
 */ 
function xyz() {
  /**
   * This chunk of code does this because we don't like to do it the other way.
   * Otherwise, zombie apocalypse.
   */ 
 const a = b + 1;
 doSomething(a);

 /**
  * Here we're just having fun if nothing happens
  * Busines continues as usual
  */
 doSomething(b)
}

thomasttvo avatar Feb 20 '24 21:02 thomasttvo

It refers to all multiline comments, and the guide assumes you are not using jsdoc at all.

ljharb avatar Feb 20 '24 22:02 ljharb

that's quite strange, would you say my above code is correct? Shouldn't it be like below?

/** 
 * This function does XYZ
 */ 
function xyz() {
  // This chunk of code does this because we don't like to do it the other way.
  // Otherwise, zombie apocalypse. 
 const a = b + 1;
 doSomething(a);

 // Here we're just having fun if nothing happens
 // Busines continues as usual
 doSomething(b)
}

thomasttvo avatar Feb 21 '24 01:02 thomasttvo

No, I’d say both are fine.

ljharb avatar Feb 21 '24 02:02 ljharb