Is there a more "Prototype" way to construct a variable key within  
JavaScript, similar to what you can do in PHP? For example, in PHP, if  
I had the string 'title' assigned to the variable $class, and I wanted  
the current value of the variable $titles, I could construct a  
'variable variable', which would point back to $titles:

$titles = Array('Gone with the Wind','The Wind in the Willows','Break  
like the Wind');

$class = 'title'; //plain string

$key = $class + 's'; //concatenate for poor man's pluralize

echo ($$key == $titles) ? true: false; // => true

In JavaScript, Google tells me that eval() will do the same thing, but  
I've heard over and over on this list that eval() is evil and to be  
avoided. Any suggestions?

Thanks in advance,


You received this message because you are subscribed to the Google Groups 
"Prototype &" group.
To post to this group, send email to
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at

Reply via email to