Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] variable whose name is the result of a calculation?
- From: javascript@xxxxxxxxxx (charlie_chan)
- Subject: [Javascript] variable whose name is the result of a calculation?
- Date: Wed, 11 Dec 2002 12:13:54 -0600
The entire code would help a lot! Not enough info here to understand what you are doing. ----- Original Message ----- From: "Anthony Webster" <awebster@xxxxxxxxx> To: <javascript@xxxxxxxxxx> Sent: Wednesday, December 11, 2002 5:50 AM Subject: [Javascript] variable whose name is the result of a calculation? hi all, I want to define a new variable, whose name is the result of a calculation. does this make sense? a simple example follows var1 = 'ora'; var2= 'nge'; var3 = var1 + var2; // result: // var3 = 'orange'; eval(var3) = '263'; // intended result: // orange = '#FB8E36'; of course when I do this, javascript is not happy. it doesnt like the left hand side with the 'intended result' bit. why am I doing things like this? I am going to be supplied the names of the colours without knowing what they will be. I will need to evaluate what they are and then declare variables for each of them so I can reuse this information. any help would be greatly appreciated! thanks, anthony _______________________________________________ Javascript mailing list Javascript@xxxxxxxxxx https://lists.LaTech.edu/mailman/listinfo/javascript
- References:
- [Javascript] variable whose name is the result of a calculation?
- From: Anthony Webster
- [Javascript] variable whose name is the result of a calculation?
- Prev by Date: [Javascript] (no subject)
- Next by Date: [Javascript] Split
- Previous by thread: [Javascript] variable whose name is the result of a calculation?
- Next by thread: [Javascript] (no subject)
- Index(es):