Accessing a variable by reference in Javascript
<p>I'm trying to pass a reference to a variable and then update the contents in javascript, is that possible? For example a simple (fail) example would be...</p>

<pre><code>var globalVar = 2;

function storeThis ( target, value ) {
    eval(target) = value;
}

storeThis( 'globalVar', 5);
alert('globalVar now equals ' + globalVar);
</code></pre>

<p>This of course doesn't work, can anyone help?</p>
