所以我想创建一个函数如下:
使用各种数量的参数
/**
* Stuff with one argument.
* @method foo
* @param {type} a One argument.
*/
/**
* Stuff with more arguments.
* @method foo
* @param {type} a1 Argument one.
* @param {type} a2 Argument two enz.
*/
function foo() {
if (arguments.length > 1) {
// Awesome code thats doing stuff with more arguments
} else {
// Awesome code thats doing stuff with one argument
}
}
使用不同类型的参数
/**
* Stuff with string argument.
* @method doo
* @param {string} s String argument.
*/
/**
* Stuff with number argument.
* @method doo
* @param {number} n Number argument.
*/
function doo() {
if (typeof arguments[0] == "string") {
// Awesome code thats doing stuff with string
} else if (typeof arguments[0] == "number") {
// Awesome code thats doing stuff with number
}
}
如何实现我可以逐步完成不同的文档注释?