Is there a way to turn a JS object into a function?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/124326/how-to-convert-an-object-into-a-function-in-javascript">How to convert an &quot;object&quot; into a function in JavaScript?</a>  </p>
</blockquote>



<p>I have a theoretical question. As far as I know, {} objects come from Object, and functions inherit from that as well. Is there something user-accessible that can make {} objects callable, like functions, or is it interpreter magic?</p>

<p>I'm thinking of something like:</p>

<pre><code>var myobj = {}
myobj["__call"] = function() {do_things();}
myobj();
</code></pre>

<p>and have it work. Is it possible? If not, why not?</p>

<p>Thanks!</p>
