Still an other solution would be to put the function a in a namespace and
pass that along with the attribute you want to change as a string:

var myNameSpace = {
    a: {}
};

function change(nameSpace, attribute){
    nameSpace[attribute] = function(){};
}

change(nameSpace, 'a');   //You give the function 'change' access to the
entire namespace.

For global objects you could pass 'window' as the name space.
Still, I wouldn't really do this, as said before, it's very hard to maintain
code like this.

Daan Porru

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/[email protected]/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/[email protected]/

To unsubscribe from this group, send email to
[email protected]

Reply via email to