var name = "The Window"; var object = { name : "My Object", getNameFunc : function(){ var that = this; return function(){ return that.name; }; } }; console.log(object.getNameFunc(); console.log(object.getNameFunc()()); var object1= { name : "My Object1", getNameFunc : function(){ return function(){ return this.name; }; } }; console.log(object1.getNameFunc()());