title: How to execute a function which details are passed as parm in another function
body: <p>I need to execute an external function with params. The external function can be different so I am passing the details of external function with a main function is called. The main function takes object as params. So the information I am sending is transmitting correctly. However, when it's time to execute the external function the object key is trying to execute instead the value, hence I am getting error. What am I missing? Is there a better way to take resolve this issue?  </p>
  
  <p>HTML:</p>
  
  <pre><code> &lt;button onclick="fn.funcExt({name: 'foo', param: 'bar+baz'})"&gt;Check&lt;/button&gt;
  </code></pre>
  
  <p>JS: </p>
  
  <pre><code>fn = (function(){
  
  var publicAPI = {
  
      funcExt: function(o){return funcExt(o)}
  };
  
  
  ////////////////////////////////////
  
  function funcExt(o){
      console.log(o.name)
      console.log(o.param)
      o.name(o.param);
  }
  
  
  
  return publicAPI;
  })();
  
  
  /////////////////////////////////////////
  
  function foo(s){
     alert('passed' + s);
  }
  </code></pre>
  
  <p>Fiddle: <a href="http://jsfiddle.net/rexonms/sf8f05fh/" rel="nofollow">http://jsfiddle.net/rexonms/sf8f05fh/</a></p>