For example:
function foo() {
var bar = "", obj = {};
obj.change = function(key, val){
// how change bar?
return obj;
}
return obj;
}
foo().change("bar", "foo");
If bar will be obj.bar answer is obj[key] = val; but then bar will be public. I want to have ability to set bar in jQuery-like style, but not to make it public.