且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在JavaScript中创建可变参数(具有可变长度的参数列表)函数包装器

更新时间:2023-08-23 07:54:52

只需使用apply().对于您的陈旧执行引擎,只需执行

Just use apply(). And for your antiquated execution engines, just do this

if ( 'undefined' == typeof Function.prototype.apply )
{
  Function.prototype.apply = function( context, args )
  {
    // whatever hacky way you want to implement it - i guess eval.
  }
}