I need to evaluate a variable as an objects name and then retrieve the values of particular names within the object.
The object:
var priority = [{dSubDue:'1,D', dMS2date:"1.5,'M'", dMS3date:'3,M',dMS4date:'30,D',dMS5date:'1,M',dNotErFac:'2,W',dDOverview:'N/A',dPreACMResp:'2,W',dACMdate:'2,W',dMS6date:'2,W',dMS7date:'1,M',dM86date:'1.5M'}];
where the name of the object is priority
.
When another variable, cellval
, is set to the same name as the object "priority"
I need to access the key values in actual priority object by using the following cellval[0]['dMS2date']
.
If I use eval(cellval[0]['dMS2date'])
it returns the correct values but if possible I'd prefer not to use eval.
Any Ideas?