Say I have the following code - and by "I" I mean that its not my code and I cannot remove the new operation. I only received the instance of foo after its instantiated.
var foo = new function() {
this.bar = 'baz';
}
Is it possible to get the original function and effectively perform another new on it? If so, are there cases where it would not be a clean clone?
var secondFoo = ...foo...
secondFoo.bar = 'qux';
foo.bar // 'bad'
secondFoo.bar // 'qux'