var myMethods = {}; ;(function(){ function ConsFunc(){} Object.assign(ConsFunc.prototype,{ a1(){ console.log('a1'); }, a2(){ console.log('a2'); } }); myMethods.ConsFunc = ConsFunc; })(); var fn1 = new myMethods.ConsFunc(); fn1.a1(); fn1.a2();