Say, I have two functions:
function foo() { this.lorem = \'ipsum\'; } function boo() { console.log(this.lorem); }
And I want to insert the
If you don't want to modify the existing functions do this:
function foo() { this.lorem = 'ipsum'; } function boo() { console.log(this.lorem); } function bar() { boo.call(new foo); } bar();
Here's a JSFiddle of it in action: http://jsfiddle.net/8Wb6T/