title: executing anonymous functions created using JavaScript eval()
body: <p>I have a function and its contents as a string.</p>
  
  <pre><code>var funcStr = "function() { alert('hello'); }";
  </code></pre>
  
  <p>Now, I do an eval() to actually get that function in a variable.</p>
  
  <pre><code>var func = eval(funcStr);
  </code></pre>
  
  <p>If I remember correctly, in Chrome and Opera, simply calling</p>
  
  <pre><code>func();
  </code></pre>
  
  <p>invoked that function and the alert was displayed.</p>
  
  <p>But, in other browsers it wasn't the case. nothing happened.</p>
  
  <p>I don't want an arguement about which is the correct method, but how can I do this? I want to be able to call variable(); to execute the function stored in that variable.</p>