Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #37428

Re: Adding a variable to a variable NAME

Newsgroups comp.lang.javascript
Date 2019-09-27 02:40 -0700
References <87e082ab-26c6-4b36-b5fd-21785c59a872@googlegroups.com>
Message-ID <fbcdc47a-5199-4102-8efd-5afe9e1226a2@googlegroups.com> (permalink)
Subject Re: Adding a variable to a variable NAME
From dr.j.r.stockton@gmail.com

Show all headers | View raw


On Friday, 27 September 2019 07:55:28 UTC+1, gro...@cyberdude.com  wrote:

> ...
> but how would I assign the NAME of the variable to be "var" + the loop variable? ie. var1, var 2, so on?
> 
> 
> PHP calls this $$x, unless I'm mistaken - how does *JS* do it? :)


UNTESTED - but something like   for (i ... ) window["var"+i] = Str, and for variables local to a function use the name of the function ?? ??


-- 
  (c) John Stockton, near London, UK.  Using Google Groups.           |
 Mail: J.R.""""""""@physics.org - or as Reply-To, if any.             |

Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Adding a variable to a variable NAME groovee@cyberdude.com - 2019-09-26 23:55 -0700
  Re: Adding a variable to a variable NAME Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-09-27 00:25 -0700
  Re: Adding a variable to a variable NAME dr.j.r.stockton@gmail.com - 2019-09-27 02:40 -0700

csiph-web