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?
eg:
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;
}
Is this even possible or should I be thinking of doing this differently?
Use an indexer: