Give variable name but not its value to a function
<p>To remove tedious code i would like to create a function to simplify it.<br>
So to change the settings that i stored in an object, I created this.</p>

<pre><code>var settings = {
    color : 'red'
    //one of many settings
};
alert(settings.color); // returns red
function changeValue(property, value){
    settings.property = value;
}
changeValue('color', 'blue');
alert(settings.color); // still return red
</code></pre>

<p>it seems like its treated as a string instead.<br>
And if i try this: </p>

<pre><code>function changeValue(object, value){
    object = value;
}
changeValue(settings.color, 'blue');
</code></pre>

<p>it would only give the function the value which is 'red'.<br>
and this:</p>

<pre><code>changeValue('settings.color', 'blue');
</code></pre>

<p>would not work obviously.</p>

<p>So how do i solve this ? How do i pass down a variable to a function but not its value so it can be altered ?</p>

<p>Note: the function is simplified for now, but would contain a lot more magic when it works.</p>
