【发布时间】:2010-11-21 22:18:20
【问题描述】:
是否可以将 JavaScript 中的数组转换为函数参数序列?示例:
run({ "render": [ 10, 20, 200, 200 ] });
function run(calls) {
var app = .... // app is retrieved from storage
for (func in calls) {
// What should happen in the next line?
var args = ....(calls[func]);
app[func](args); // This is equivalent to app.render(10, 20, 200, 200);
}
}
【问题讨论】:
-
在这里也检查类似的问题:stackoverflow.com/questions/2856059/…
-
我想这并不重要,但这个旧问题被标记为新的引用问题的副本似乎很奇怪?
标签: javascript arrays arguments