function a(){ var num = 10; return function(){ num ++; console.log(num); } } a()(); //11 a()(); //11 function a(){ var b = 0; return function(){ b ++; console.log(b); } } var d = a(); d();//1 d();//2