In my JavaScript code, I declare global variables named with the prefix "sld_label" where "label" can be any string. These variables are initialized as objects that contain a function called setval. Now, I have a function that receives a label in a string parameter called qq and I need to determine if the corresponding sld_label variable has been defined. How can I achieve this without causing an error?
Currently, I am using the following code snippet (which works but triggers an error in Firebug):-
function setclrques(qq, op)
{
if (typeof(eval('sld_'+qq))=='object') eval('sld_'+qq+'.setval('+op+')');
}
Any assistance would be greatly appreciated!