Calling a JavaScript Function With Arguments That Are Decided Later
<p>I want to store a pointer to a function and then call it later with some arguments, but I'm having trouble with how to pass the arguments to the function.</p>

<p>For example:</p>

<pre><code>var MyObject = (function () {
    return {
        myMethod: function (a, b) {
            return a + b;
        }
    };
}());

var method = MyObject.myMethod;
var args = [2, 5];

method(args);
</code></pre>

<p>So in the last line, which I know doesn't do what I want <code>method(args)</code>, I want to essentially call <code>MyObject.myMethod(2, 5)</code>, so my array attempt fails and creating an object also fails. How do I pass in the stored arguments to the stored method?</p>
