【发布时间】:2013-11-21 04:50:45
【问题描述】:
我有一个 JavaScript 函数:
function test() {
console.log(arguments.length);
}
如果我用test(1,3,5) 调用它,它会打印出3,因为有3 个参数。如何从另一个函数中调用 test 并传递另一个函数的参数?
function other() {
test(arguments); // always prints 1
test(); // always prints 0
}
我想调用 other 并让它调用 test 及其 arguments 数组。
【问题讨论】:
标签: javascript function arguments