There are many ways to change the context. jsfiddle
using bind: (not supported by older IE browsers (IE <9))
var obj = {}; function fun1(){}; obj2 = {}; obj2.fun1 = fun1.bind(obj); obj2.fun1();
Using an application or call.
var obj = {}; function fun1(){}; obj2 = {}; obj2.fun1 = function(){ fun1.apply(obj, arguments);
Anoop source share