Skip to content

24 ways to impress your friends

Vote down?

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’?