How can an Array be used as a property name?
<p>How does this code work?</p>

<pre><code>if (!(args in pad)) {
    pad[args] = self.apply(obj, arguments);
}
</code></pre>

<p>args is array, but shouldn't it be a string because it's a key of JS object?
How would check work? <code>array in object</code>?</p>

<p>Full context <a href="http://talideon.com/weblog/2005/07/javascript-memoization.cfm" rel="nofollow">here</a>:</p>

<pre><code>Function.prototype.memoize = function() {
    var pad  = {};
    var self = this;
    var obj  = arguments.length &gt; 0 ? arguments[i] : null;

    var memoizedFn = function() {
        // Copy the arguments object into an array: allows it to be used as
        // a cache key.
        var args = [];
        for (var i = 0; i &lt; arguments.length; i++) {
            args[i] = arguments[i];
        }

        // Evaluate the memoized function if it hasn't been evaluated with
        // these arguments before.
        if (!(args in pad)) {
            pad[args] = self.apply(obj, arguments);
        }

        return pad[args];
    }

    memoizedFn.unmemoize = function() {
        return self;
    }

    return memoizedFn;
}
</code></pre>
