title: How can I use Javascript functions as parameters for another function?
body: <p>Whenever I try to run this function in Chromium, I get the error message "Uncaught TypeError: Illegal invocation". Why does this occur, and how can I resolve it?</p>
  
  <pre><code>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 &lt; functions.length; i++){
          for(var j = 0; j &lt; arguments.length; j++){
              functions[i](arguments[j]); //why doesn't this call the function
          }
      }    
  }​
  </code></pre>