Resolve function pointer in $(document).ready(function(){}); by json string name
<p>I have a json object retrieved from server in my <code>$(document).ready(...);</code> that has an string that I would like to resolve to a function also defined within <code>$(document).ready(...);</code> so, for example:</p>

<pre><code>$(document).ready(function{

    $.getJSON(/*blah*/,function(data){/*more blah*/});
    function doAdd(left,right) {
        return left+right;
    }
    function doSub(left,right) {
        return left-right;
    }
});
</code></pre>

<p>with json string:</p>

<pre><code>{"doAdd":{"left":10,"right":20}}
</code></pre>

<p>One way I thought about was creating an associative array of the function before loading the json:</p>

<pre><code>var assocArray=...;
assocArray['doAdd'] = doAdd;
assocArray['doSub'] = doSub;
</code></pre>

<p>Using <code>eval</code> or <code>window[]();</code> are no good as the function may not be called for some time, basically I want to link/resolve but not execute yet.</p>
