Suppose you use the following structure:
var Args = new Object();
Args.Age = '10';
Args.Weight = '10';
Args.GetAge = function() {
return 'I am ' + Age + ' years old';
}
Args.GetWeight = function() {
return 'I weigh ' + Weight + ' pounds';
}
That works great. But is it possible to use a generic so you don't have to create a function for each variable? For example, something like the following:
Args.GetValue = function(i) {
return this.i;
}
That doesn't seem to work but I don't even know if this is possible. Anyone know the answer to this riddle?