Skip to content

24 ways to impress your friends

Vote up?

Chad

Sure, this is wrong:
var propertyName = ‘myProperty’;
eval(‘object.’ + propertyName); ——- but what about this?

var propertyName = ‘myChildObject.myProperty’
eval(‘object.’ + propertyName); ?

How else would I get to myProperty if all I have is the string, and the data is inside of the local var ‘object’?