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,

Walter

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to