So I created a function like this,
var functionName = function(arg1) { //code logic here; }
At the same time, I need this function to work
You want to implement a delegate to myObj:
var functionName = function(arg1) { // code } functionName.myObj = new MyObj(); for (prop in functionName.myObj) { if (functionName.myObj.hasOwnProperty(prop)) { functionName.__defineGetter__(prop, function() { return functionName.myObj[prop]; } ); } }