faqts : Computers : Programming : Languages : JavaScript : Language Core

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

14 of 18 people (78%) answered Yes
Recently 8 of 10 people (80%) answered Yes

Entry

How can I create a variable named dog from the variable tmp="dog"?

Dec 14th, 2001 13:04
Will Ghomi, Phil S.,


You can use the "eval" function:
var tmp = "dog";
eval("var " + tmp + " = 'hello';");
alert(dog);