我的目标是迭代一个函数列表,然后依次调用每个函数。我想避免使用匿名函数,但我很难找出自己的错误所在(使用下划线,但原则应该非常相似)。Uncaught TypeError: Function.prototype.apply was called on undefined, which is a undefined and not afunction
我认为这是因为迭代器func是用三个参数(item、index、array)调用的,而Function
数组的第一个元素是一个函数,其余的是参数。例如:因此,我需要用参数(a, b) => a + b和7调用函数5。但是,我不想使用arr[0](...arr.slice(1)),而是想使用Function.prototype.apply和Function.prototype.call (如果需要的话也可以使用Function.prototype.bind因此,基本上,我只允许访问arr一次,并且不