title: Javascript function pointer with argument as parameter in a function
body: <p>Not sure if the title is worded correctly, or if there is a better way of saying it, but I think its okay.</p>
  
  <p>At any rate, I understand the following thus far:</p>
  
  <pre><code>a.b("a", "b", "c", foo);
  </code></pre>
  
  <p>Where "foo" is a function defined elsewhere that takes in no arguments would simply result in the function a.b() running, with the above parameters.  The parameter "foo" can then be called inside function a.b() as simply "foo()".  In other words, I understand the above call to be using a function pointer as an argument in the function a.b as a parameter.</p>
  
  <p>Okay, now here is what I'm trying to do...</p>
  
  <p>I want to be able to do something similar to the above, except this time I want foo to have a paramater passed in that argument as follows:</p>
  
  <pre><code>a.b("a", "b", "c", foo("bar"));
  </code></pre>
  
  <p>Now here is the problem.  This will literally result in the paramaters "a", "b", "c" and the <strong>result of foo("bar")</strong> being used.  I don't want this.  I want foo("bar") to literally be passed in so that in the function a.b which would look like this (as the header):</p>
  
  <pre><code>a.b(first, second, third, fourth);
  </code></pre>
  
  <p>Could reference and call the fourth parameter as:</p>
  
  <pre><code>fourth();
  </code></pre>
  
  <p>Even if "fourth" has an argument in it.  I can't seem to find a way around this problem, any advice?</p>
  
  <p>Thanks!</p>