you should really read the book first... complaining about "rtfm-calls" 
without knowing basic stuff about the language is pretty much trolling.

Am Mittwoch, 12. Dezember 2012 04:18:08 UTC+1 schrieb spqr:
>
>
> Thanks for your help on this, I think you solved my problem with "this" by 
> helping me avoid eval().  
> Coming at JavaScript with some history in lisp, maybe my question should 
> have been "why does JavaScript have eval()?" ;-)
> (Hah! I know it still has its uses...)
>
> I just constructed this code:
>
> var myobjs = { p1234: { a: 1,
>                        b: function() { var c = this.a; return 0; }},
>                       p2345: { a: 2,
>                        b: function() { var c = this.a; return 1; }}};
>
> var q = "p1234";
> myobjs[q].b();
>
> I ran a quick test and it works like a charm.  I noticed that the object 
> keys can be
> literals or strings and it still works.  Is there any preference on which 
> to use? 
>

-- 
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 nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to