Skip to content Skip to sidebar Skip to footer

Accessing Object And Property Via Variable?

I have a namespace setup like mySpace.util = { valid: { first: function() { //blah } } } I am trying to pass the valid and first as

Solution 1:

var obj = 'valid',
    meth = 'first';

mySpace.util[obj][meth]();

Post a Comment for "Accessing Object And Property Via Variable?"