title: executing function based on condition
body: <p>I want to write something like this:</p>
  
  <pre><code>function MyFunction () { .... return SomeString; }
  function SomeFunction () { ... return SomeOtherString; }
  
  function SomeCode() {
  
    var TheFunction;
  
    if (SomeCondition) {
  
      TheFunction = SomeFunction;
  
    } else {
  
      TheFunction = SomeCode;
    }
  
    var MyVar = TheFunction(); // bugs here
  }
  </code></pre>
  
  <p>Basically, I'd like to execute a function after some condition has been evaluated so that variable MyVar contains contains the result of the function that has been called.</p>
  
  <p>What am I missing to make this work?</p>
  
  <p>Thanks.</p>