HighDots Forums  

Re: Is there a way to dynamically assign a variable name??

Javascript JavaScript language (comp.lang.javascript)


Discuss Re: Is there a way to dynamically assign a variable name?? in the Javascript forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Richard Cornford
 
Posts: n/a

Default Re: Is there a way to dynamically assign a variable name?? - 10-11-2003 , 12:18 AM






"Terry" <saintkilda (AT) shaw (DOT) ca> wrote

<snip>
Quote:
I'm wondering if there is a way to dynamically generate the
variable names (ie: T1val, T2val, etc.) in my function 'calc',
based on the argument 'regnum' that I pass it. ...
snip
script language="JavaScript"
T1val=0;
T2val=0;
T3val=0;

function calc(regnum) {
snip

If you mean global variables then yes. Global variables are properties
of the global object and object properties can be dynamically created.

Follow the link from:-

<URL: http://www.jibbering.com/faq/#FAQ4_339 >

- for some explanation of how.

Richard.




Reply With Quote
  #2  
Old   
HikksNotAtHome
 
Posts: n/a

Default Re: Is there a way to dynamically assign a variable name?? - 10-11-2003 , 01:49 AM






In article <bm80ag$o1d$1$8300dec7 (AT) news (DOT) demon.co.uk>, "Richard Cornford"
<Richard (AT) litotes (DOT) demon.co.uk> writes:

Quote:
Follow the link from:-

URL: http://www.jibbering.com/faq/#FAQ4_339

- for some explanation of how.
We are up to 339 now? <ducking>
--
Randy


Reply With Quote
  #3  
Old   
Richard Cornford
 
Posts: n/a

Default Re: Is there a way to dynamically assign a variable name?? - 10-13-2003 , 09:44 PM



"HikksNotAtHome" <hikksnotathome (AT) aol (DOT) com> wrote

Quote:
In article <bm80ag$o1d$1$8300dec7 (AT) news (DOT) demon.co.uk>, "Richard Cornford"
Richard (AT) litotes (DOT) demon.co.uk> writes:

Follow the link from:-

URL: http://www.jibbering.com/faq/#FAQ4_339

- for some explanation of how.

We are up to 339 now? <ducking
Oops! I intended:-

<URL: http://www.jibbering.com/faq/#FAQ4_39 >

(I did a bit much cutting and pasting and not enough deleting).

Richard.




Reply With Quote
  #4  
Old   
Terry
 
Posts: n/a

Default Re: Is there a way to dynamically assign a variable name?? - 10-15-2003 , 02:26 PM



Hi Richard,

Thank you for the link. Had to read it a few times, and study it a
bit. But that is exactly what I needed,... and works great. The link
on that page gives a great synopsis on Globabl Variables.

Terry.


On Tue, 14 Oct 2003 02:44:17 +0100, "Richard Cornford"
<Richard (AT) litotes (DOT) demon.co.uk> wrote:

Quote:
"HikksNotAtHome" <hikksnotathome (AT) aol (DOT) com> wrote in message
news:20031011014958.21232.00001158 (AT) mb-m13 (DOT) aol.com...
In article <bm80ag$o1d$1$8300dec7 (AT) news (DOT) demon.co.uk>, "Richard Cornford"
Richard (AT) litotes (DOT) demon.co.uk> writes:

Follow the link from:-

URL: http://www.jibbering.com/faq/#FAQ4_339

- for some explanation of how.

We are up to 339 now? <ducking

Oops! I intended:-

URL: http://www.jibbering.com/faq/#FAQ4_39

(I did a bit much cutting and pasting and not enough deleting).

Richard.



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.