我有一个通过访问arguments变量接受多个数组的函数:
/**
* @param options An object containing options
* @param [options.bind] blablabla (optional)
*/
function modify_function (options) {
for (var i=1; i<arguments.length; i++) {
// ...
}
}
Run Code Online (Sandbox Code Playgroud)
现在,我知道除了每个参数options都是一个包含值得记录的值的数组:
[search_term, replacement, options]
Run Code Online (Sandbox Code Playgroud)
我不打算将(冗长的)描述放在变量参数行中.
@param {...}包含搜索词,替换词及其选项的数组; index 0:函数内的搜索项; 1:替换文字; 2:可选选项(catch_errors:捕获错误并记录它,escape:替换文本中的escape美元,pos:"L"用于在搜索项之前放置替换,"R"用于放置它之后)不是可读解决方案类型不可见.
有没有办法记录变量参数的类型和值?
@param {...[]} An array with search terms, replacements and its options
@param {...[0]} The search term within the function
@param {...[1]} The replacement text
@param {...[2]} An optional object with obtions for the …Run Code Online (Sandbox Code Playgroud) 如何记录可变数量的参数?我正在用PHP和JavaScript编写应用程序.目前我有(在JavaScript中):
/**
* Description
* @param {String} description
*/
function fn()
{
// arguments holds all strings.
}
Run Code Online (Sandbox Code Playgroud)
那么,我该如何编写n个字符串参数?