Say, I have two functions:
function foo() { this.lorem = \'ipsum\'; } function boo() { console.log(this.lorem); }
And I want to insert the
Wrap them both under the same context:
var myClass = { foo: function foo() { this.lorem = 'ipsum'; this.boo(); }, boo: function boo() { alert(this.lorem); } };
Then to activate foo:
foo
myClass.foo();
Live test case.