Call a javascript function that's a member of an object by name
<p>I want to be able to pass a reference to an arbitrary function by name to another javascript function. If it's just a global function, there is no problem:</p>

<pre><code>function runFunction(funcName) {
   window[funcName]();
}
</code></pre>

<p>But suppose the function could be a member of an arbitrary object, e.g.:</p>

<pre><code>object.property.somefunction = function() {
 //
}
</code></pre>

<p><code>runFunction("object.property.somefunction")</code> does not work. I know I can do this:</p>

<p><code>window["object"]["property"]["somefunction"]()</code></p>

<p>So while could write code to parse a string and figure out the heirarchy this way, that seems like work :) So I wondered if there's any better way to go about this, other than using <code>eval()</code></p>
