[Javascript] Subscript Notation
Troy III Ajnej
trojani2000 at hotmail.com
Tue Nov 22 12:16:31 CST 2011
> So my question. Is it possible to use subscript notation for the first part of an object something like...
>
> ['a'].name -Of course it is... >or ['a']name
> -no, that's a syntax error. [the dot is required for property separation there]
> Or would I have to resort to eval() to do something like that. -not necessarily. > this seems to work...
>
> eval('a').name
-it sure does, it has to.>
> But eval is bad...
-how do you know that?!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Troy III
progressive art enterprise
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> So my question. Is it possible to use subscript notation for the first part of an object something like...
>
> ['a'].name or ['a']name
>
> Or would I have to resort to eval() to do something like that. This question is realted to my earlier one but I would be interested in an answer apart from my earlier post.
>
> this seems to work...
>
> eval('a').name
>
> But eval is bad and I want to avoid it.
>
> Thanks,
>
> Terry
> _______________________________________________
> Javascript mailing list
> Javascript at lists.evolt.org
> http://lists.evolt.org/mailman/listinfo/javascript
More information about the Javascript
mailing list