【发布时间】:2018-11-02 16:13:39
【问题描述】:
为什么我的字段会被 jsdoc 忽略?
/**
* Matrix object for operations on matrices
* @constructor
* @param {number[][]} m - values
* @param {number} def - default size def x def
*/
function Matrix(m, def){
/**
number[][] - values
*/
this.m;
/**
* number - number of rows
*/
this.rows;
/**
* number - number of cols
*/
this.cols;
if(m != null){
this.m = m;
this.rows = m[0].length;
this.cols = m.length;
}
else {
this.m = new Array(def);
for (var i = 0; i < def; i++) {
this.m[i] = new Array(def);
}
this.rows = def;
this.cols = def;
this.initI();
}
}
/**
* initializes the Matrix as Ident-Matrix
*/
Matrix.prototype.initI = function(){
for(var i = 0; i < this.rows; i++){
for(var j = 0; j < this.cols; j++) {
if(i == j) this.m[i][j] = 1;
else this.m[i][j] = 0;
}
}
}
通常会解析对象及其函数,但是字段
m、rows 和 cols 被 jsdoc 忽略。
在我不使用prototype 语法的另一个代码中,它通常会解析。
编辑数字
【问题讨论】:
-
double和int不是 javascript 类型,请改用number。 -
我把所有东西都改成了数字,但还是找不到
标签: javascript field documentation jsdoc jsdoc3