title: javascript equivalent of PHP's call_user_func()
body: <p>Does anyone know if there is one?</p>
  
  <p>I want to call a function using a variable name.</p>
  
  <p><hr>
  edit:</p>
  
  <p>I posted a fiddle here with what I'm trying to do:</p>
  
  <h2><a href="http://jsfiddle.net/sAzPA/" rel="noreferrer">http://jsfiddle.net/sAzPA/</a></h2>
  
  <pre><code>&lt;div id="some"&gt;
    ...
  &lt;/div&gt;
  </code></pre>
  
  <p>js:</p>
  
  <pre><code>(function($){
    $.fn.MyPlugin = function(){
  
      return this.each(function(){
         var somefunction = function(arg1, arg2){ alert(arg1); },
             someotherfunction = function(arg1, arg2){ alert(arg2); },
             reallyimportantfunction = function(arg1, arg2){
              var foo = $(this).attr('id') + 'function';
  
              // here I want to call the function with the foo value as name, and pass it arg1 and arg2
  
              $()[foo](arg1, arg2); // &lt;- doesn't work
  
             };
  
         reallyimportantfunction();
      });
    };  
  })(jQuery);
  
  
  jQuery(function($){
    $('#some').MyPlugin ();
  
  });
  </code></pre>