Set the value of json object dynamically via a function parameter
<p>How could I set the value of an item in a json object by passing in the name of it via a parameter to a function?</p>

<p>eg:</p>

<pre><code>this.loadStates = function() {
    that.setStateIfExists('inStock', true);
}

this.setStateIfExists = function (param, option) {
    // i'd like this to be 'that.selectedFinderOptions.inStock = option'
    that.selectedFinderOptions.param = option;  
}
</code></pre>

<p>Is this even possible or should I be thinking of doing this differently?</p>
