How to pre-compute value lookup in a function
<p>I'm trying to figure out the right syntax for "pre-computing" the property value to look up in the "withPrefix" function below so that I can pass that function around and it will not depend on the current value of x at the time of execution.</p>

<pre><code>var a = { 
    one: 'First Name',
    two: 'Last Name'
};

var x = 'one';
var withPrefix = function(value) {
    return a[x] + ": " + value;
};

console.log(withPrefix);
</code></pre>

<p>Of course this is a contrived example and the real one is more complex, but tried to reduce it to simplest case. The console.log output says:</p>

<pre><code>function (value) {
    return a[x] + ": " + value;
} 
</code></pre>

<p>But I want it to be something like:</p>

<pre><code>function (value) {
    return a['one'] + ": " + value;
} 
</code></pre>

<p>I use jQuery and RequireJS. If either of those libraries have any helpers for this, that would be an acceptable solution, but I suspect there's a pure javascript way of doing it.</p>
