Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何动态调用此函数?如何在此动态调用的大括号内动态传递参数?
function a(b,c,d){ } var functionName = 'a'; window [functionName]();
嗯,它比你想象的要简单得多
var f = function (a, b, c) {...}; var a = ..., b = ..., c = ...; //to call a function do f(a,b,c); //or f.call(null, a, b, c); //or f.apply(null, [a,b,c]);