OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

What is the correct JSDoc syntax for a local variable?

  • Thread starter Thread starter Kirkland
  • Start date Start date
K

Kirkland

Guest
For a function like this...

Code:
function example() {
  var X = 100;

  ...

  var Y = 'abc';

  ...

  return Z;
}

I need to explain the purpose of some of the local variables. Adding a description like this...

Code:
function example() {
  /**
   * @description - Need to explain the purpose of X here.
   */
  var X = 100;

  ...

  /**
   * @description - Need to explain the purpose of Y here.
   */
  var Y = 'abc';

  ...

  return Z;
}

...doesn't seem to be getting picked up by JS Doc v3.4.0.

What is the correct syntax?

P.S. Some of my use cases call for multi-line comments.

<p>For a function like this...</p>

<pre><code>function example() {
var X = 100;

...

var Y = 'abc';

...

return Z;
}
</code></pre>

<p>I need to explain the purpose of some of the local variables. Adding a description like this...</p>

<pre><code>function example() {
/**
* @description - Need to explain the purpose of X here.
*/
var X = 100;

...

/**
* @description - Need to explain the purpose of Y here.
*/
var Y = 'abc';

...

return Z;
}
</code></pre>

<p>...doesn't seem to be getting picked up by <code>JS Doc v3.4.0</code>.</p>

<p>What is the correct syntax?</p>

<p>P.S. Some of my use cases call for multi-line comments.</p>
 
Top