spread(someFunction, [1, true, "Foo", "bar"]) // is the same as...
someFunction(1, true, "Foo", "bar")
我写了这个代码,但得到了一些错误:创建一个函数,它的另一个功能为本身
function spread(func, args) {
func();
}
function func(args){
console.log(args[0] + args[1]);
}
spread(func,[5,6])
类型错误:参数表是不确定的,但我无法定义它,因为它会被定义时调用该函数。
spread(func,[5,6])
而且我也不能使用变量。我可以只是这种功能。 (这是一个测试)
你调用'func()'而不传递任何参数给它。 – Pointy