Accepted conventions when using 'this' with function.apply
<p>I'm trying to implement a primitive type of Polish Notation Calculator and I'm using an object to define each operation.</p>

<p>Such that calling </p>

<pre><code>new RPNCalculator().calculate([4, 5, '+']);
</code></pre>

<p>will produce an answer of 9 or </p>

<pre><code>new RPNCalculator().calculate([4, 5, '+', 3, 5, '+', '*']);
</code></pre>

<p>will produce an answer of 72.</p>

<p>The code is here:</p>

<pre><code>function RPNCalculator(arr) {

    this.calculate = function(arr) {
        var resultArr =[];
        for(var i=0; i &lt; arr.length; i++) {
            if(typeof(arr[i]) == 'number') {
                resultArr.push(arr[i]);
            }
            else {
                var a = resultArr.pop();
                var b = resultArr.pop();
                var c = opers[arr[i]].apply(this, [a, b]);
                resultArr.push(c);
            }
        }
        return resultArr.pop();
    }

    var opers = {
        "+": function(a, b) { return a + b; },
        "-": function(a, b) { return a - b; },
        "*": function(a, b) { return a * b; },
        "/": function(a, b) { return a / b; }
    }
}
</code></pre>

<p>The calculations work correctly, but what I would like to know is whether the following line</p>

<pre><code>var c = opers[arr[i]].apply(this, [a, b]);
</code></pre>

<p>is the best way to invoke the required function contained inside the <code>opers</code> object based on the symbol at the current index in the array, or is there a better way to do it?</p>
