Let's say I have:
var test = {};
test.Data1 = {
...JSON objects here...
};
test.Data2 = {
...JSON objects here...
};
and so on...
I usually access these json objects followed by a set of calls by:
this.scope.testData = test['Data1'];
However, may data for test is getting larger so i just wanted to pass whatever data i want to a function and do the processing like:
this.scope.setupData = function(data)
{
var fData = test[data]; // is this line correct?
...
...
return fData;
};
but it's not working. I'm getting :Cannot set property "fData" of undefined to "[object Object]" ... I'm new to javaScript, any help would be appreciated.
dataas a property name... butdatais an Object.setupData?