Something I missed (I had it at Python): exec.
So I could create a local variable with a dynamic name:
mynewname = ....
exec("var " + mynenname + " = .... ");
Ok, only one case found yet. I could circumvent it using
myobj[mynewname] = ...
with (myobj) {
.... // use mynewname "alone"
}
On Wed, Dec 12, 2012 at 4:17 AM, Isaac Schlueter <[email protected]> wrote:
> On Tue, Dec 11, 2012 at 7:18 PM, spqr <[email protected]> wrote:
> > maybe my question should have been "why does JavaScript have eval()?" ;-)
>
> I think a lot of people have wondered the same thing.
>
> Yes, it has its uses, but at this point, I don't know of any that
> aren't better served using some other mechanism. eval() has weird
> optimization-destroying semantics that cannot ever be changed, due to
> the fact that JavaScript must be backwards compatible forever.
>
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en