This sounds like a pretty simple one but I cannot use a "dynamic" variable to refer to an array. Say I wanted to pull up "Brent_Chart_1", to locate it in the array I would do something like this:
data[i].Brent_Chart_1
Suppose though I want to loop through a number of categories, and also wanted to pull up "WTI_Chart_1". I would want to do something like this:
$comm_array = array("Brent","WTI");
for(var comm; comm = comm_array.pop();){
...
data[i].eval(comm + "_Chart_1")
...
}
This, however, does not seem to work. How should I build this reference "dynamically"?
EDIT:
Here is further context on the issue:
if (data[i].ID == 39) {
console.log(comm);
$("#" + comm + "_Chart_1").highcharts('StockChart', jQuery.parseJSON(data[i][comm + '_Chart_1']));
} else {
console.log(comm);
$("#" + comm + "_Chart_1").highcharts(jQuery.parseJSON(data[i][comm + "_Chart_1"]));
}
comm + 1
}