var close=function(){ var x=1; var enter=function(){ x++; console.log(x) } var enter2=function(){ x+=6; console.log(x); } return {f1:enter,f2:enter2}; } var C=close(); C.f1(); C.f2();