每当我尝试在 Chromium 中运行此函数时,都会收到错误消息“Uncaught TypeError: Illegal invocation”。为什么会发生这种情况,我该如何解决?
getOutput([alert], ["Hi!", "Hello!", "Lolwut?"]); //why doesn't this call "alert"
//for each of the arguments?
//this function is supposed to return the output of each function for each argument.
function getOutput(functions, arguments){
for(var i = 0; i < functions.length; i++){
for(var j = 0; j < arguments.length; j++){
functions[i](arguments[j]); //why doesn't this call the function
}
}
}