有可能做这样的事情吗?
var foo;
foo.bar = function { };
foo.variable1 = "Hello World";
foo.variable2 = 5;
...并以某种方式做到这一点,以便我可以:
function example() {
foo(); // <-- have this call foo.bar()
foo.variable1 = "Goodbye World"; // <-- but still have this work
}