I have a JavaScript object that looks like the following:
venue = function(map, dataSet) {
// set some constants
this.VENUE_ID = 0;
this.VENUE_NAME = 1;
this.VENUE_CITY = 2;
this.filterBy = function(field, value) {
...
var filterValue = 'parent.VENUE_' + field;
}
}
Now, the problem is that I need the value of filterValue
to contain the value of the constant on the parent object. Currently I have tried using the method shown above and then referencing the filterValue when trying to access the array item, but this simply returns undefined.
How do I convert the filterValue
variable into the value of the constant it represents?