title: return function from Javascript class object
body: <p>I have modularized my Javascript code in this style:</p>
  
  <pre><code>var groupHandler = function( constructorOptions )
  {
      "use strict";
  
      var init = function( optionsToSet )
      {
          jQuery.extend( options, optionsToSet);
          return this;
      };
  
  
      var newGroup = function()
      {
  
      }
  
      var call = {
          init: init,
          options: options,
          newGroup: newGroup
      };
  
      if(typeof myPublicTestNamespace == "undefined"){//http://stackoverflow.com/a/9172377/123594
          return {
              init: init,
              newGroup: newGroup
          };
      }else{
          return call;
      };
  
      init( constructorOptions );
  };
  </code></pre>
  
  <p>In one of my modules I have a list of functions from other modules to call  like this: </p>
  
  <pre><code>validatorFunctions = call.getLocalStorageArray( 'validatorFunctions', model);
  for (var f=0;f &lt; validatorFunctions.length;f++){
      if (callFunction = call.getFunction( validatorFunctions[f] )){
          valid = callFunction( loopRowId, fields, call );
          if (!valid) break;
      }
  }
  </code></pre>
  
  <p>I'd like to be able to call functions in other modules by using a "." syntax in my function call name:</p>
  
  <pre><code>var getFunction = function( functionName )
  {
      if (functionName.indexOf( '.' ) != -1){
          var functionParts = functionName.split( '.' );
          var classFunction = functionParts[1];
          if (typeof window[functionParts[0]] === "function") {
              var obj = new window[functionParts[0]]();
              return obj['classFunction'];                       &lt;!----- how to return function here?
          }
      }else{
          if (typeof (window[functionName]) === "function") {
              return window[functionName];
          }
      }
      return false;
  };
  </code></pre>
  
  <p>but I can't figure out how to return the function based on the class object and the function name?</p>