title: Pass a JavaScript function as parameter
body: <p>How do I pass a function as a parameter without the function executing in the "parent" function or using <code>eval()</code>? (Since I've read that it's insecure.)</p>
  
  <p>I have this:</p>
  
  <pre><code>addContact(entityId, refreshContactList());
  </code></pre>
  
  <p>It works, but the problem is that <code>refreshContactList</code> fires when the function is called, rather than when it's used in the function.</p>
  
  <p>I could get around it using <code>eval()</code>, but it's not the best practice, according to what I've read. How can I pass a function as a parameter in JavaScript?</p>