title: How to call function using the value stored in a variable?
body: <p>I have a variable</p>
  
  <pre><code>var functionName="giveVote";
  </code></pre>
  
  <p>What I need to do is, I want to call function stored in <strong>var functionName</strong>. I tried using functionName(); . But its not working. Please help.</p>
  
  <p><strong>Edit</strong> Based on the same problem, I have</p>
  
  <pre><code>$(this).rules("add", {txtInf: "^[a-zA-Z'.\s]{1,40}$" }); 
  </code></pre>
  
  <p>rules is a predifined function which takes methodName:, here I have hardcoded txtInf. But I want to supply a javascript variable here, to make my code generic. 
  <strong>var methodName="txtInf";</strong></p>
  
  <p>Here I want to evaluate methodName first before being used in rules function.</p>
  
  <pre><code>$(this).rules("add", {mehtodName: "^[a-zA-Z'.\s]{1,40}$" }); 
  </code></pre>