对于这样的函数...
function example() {
var X = 100;
...
var Y = 'abc';
...
return Z;
}
我需要解释一些局部变量的用途。添加这样的描述...
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;
}
...似乎没有被 JS Doc v3.4.0
接受。
正确的语法是什么?
附言我的一些用例需要多行注释。
最佳答案
我通常在我的项目中使用类似下面的代码。
function example() {
/**
* Need to explain the purpose of X here.
* @type {number}
*/
var X = 100;
...
/**
* Need to explain the purpose of Y here.
* @type {string}
*/
var Y = 'abc';
...
return Z;
}
关于javascript - 局部变量的正确 JSDoc 语法是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38708777/