title: Set up JavaScript to call function with different parameters
body: <p>I have the following ExtJS controller code:</p>
  
  <pre><code>init: function() {
      this.control({
          '#menuitem-A': { click: this.handlerA },
          '#menuitem-B': { click: this.handlerB },
      });
  },
  </code></pre>
  
  <p>and the following event handlers:</p>
  
  <pre><code>commonFunc: function(param1, param2) {
      // do something with param1 and param2 in here
  },
  
  handlerA: function(button, event) {
      this.commonFunc('param-A1', 'param-A2');
  },
  
  handlerB: function(button, event) {
      this.commonFunc('param-B1', 'param-B2');
  },
  </code></pre>
  
  <p><strong>Problem:</strong> the current code is redundant: <code>handlerA</code> and <code>handlerB</code> just call <code>commonFunc</code> with different parameters</p>
  
  <p><strong>Question:</strong>
  I would like to remove <code>handlerA</code> and <code>handlerB</code> and instead <code>call</code> or <code>apply</code> the common function <code>commonFunc</code> with the arbitrary parameters within <code>handlerA</code> and <code>handlerB</code> functions above, for different event handlers. Is it possible?</p>
  
  <p>Example:</p>
  
  <pre><code>init: function() {
      this.control({
          '#menuitem-A': { click: /*commonFunc with ['param-A1', 'param-A2']*/ },
          '#menuitem-B': { click: /*commonFunc with ['param-B1', 'param-B2']*/ },
      });
  },
  </code></pre>
  
  <p>Many thanks!</p>