In Javascript convert a string so it can be used to call a property

Posted by Jeremy Petzold on Stack Overflow See other posts from Stack Overflow or by Jeremy Petzold
Published on 2010-04-19T00:59:36Z Indexed on 2010/04/19 1:03 UTC
Read the original article Hit count: 331

Filed under:
|
|

So, I have an associative array and the keys in the array are properties of an object. I want to loop through the array and in each interation do something like this:

Object.key

This however does not work and results in returning undefined rather than the value of the property.

Is there a way to do this?

Thanks

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about strings