Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #11738
| From | Tuxedo <tuxedo@mailinator.com> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: Creating a variable named by function parameter? |
| Date | 2012-02-13 18:28 +0100 |
| Organization | albasani.net |
| Message-ID | <jhbh77$lbr$1@news.albasani.net> (permalink) |
| References | <jh8ost$tsh$1@news.albasani.net> <d6a65d73-dbb8-4957-a70d-012f7a826f3f@og8g2000pbb.googlegroups.com> |
RobG wrote:
[...]
>
> You seem to need a plain Object. Variables are really just properties
> of a local variable object, you can likely emulate what you want using
> an object:
>
> function makeup(s) {
> var localVars = {};
> localVars[s] = whatever;
> }
>
> Now you can pass around localVars to other functions, store it,
> serialise it, add, delete, modify properties and values, whatever.
>
> Of course if you are depending on finding these runtime-defined
> variables on the scope chain, an object won't do the job. But you may
> be able to substitute inheritance for scope.
Thanks for the above, it's put me on the right track....
Tuxedo
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Creating a variable named by function parameter? Tuxedo <tuxedo@mailinator.com> - 2012-02-12 17:20 +0100
Re: Creating a variable named by function parameter? Martin Honnen <mahotrash@yahoo.de> - 2012-02-12 17:44 +0100
Re: Creating a variable named by function parameter? Tuxedo <tuxedo@mailinator.com> - 2012-02-12 19:26 +0100
Re: Creating a variable named by function parameter? Tuxedo <tuxedo@mailinator.com> - 2012-02-12 21:47 +0100
Re: Creating a variable named by function parameter? RobG <rgqld@iinet.net.au> - 2012-02-12 18:42 -0800
Re: Creating a variable named by function parameter? Tuxedo <tuxedo@mailinator.com> - 2012-02-13 18:28 +0100
Re: Creating a variable named by function parameter? Robert K Quinlivan <rquinlivan@gmail.com> - 2012-02-13 21:02 -0800
Re: Creating a variable named by function parameter? Tuxedo <tuxedo@mailinator.com> - 2012-02-14 22:55 +0100
csiph-web