If I have a javascript object like this...
window.object =
{
"Element1" :
{
"startDate" : "-1m",
"endDate" : "0d"
}
};
I can use the below code to alert out -1m...
alert(object.Element1.startDate);
However, what if Element1 was given to me through a parameter as a string. How could I get the same result if I have to use a variable? Like this but not correct...
var elementId = this.id;
alert(object.elementId.startDate);