普通的函数
//普通的函数 function f1() { var num = 10; num++; return num; } console.log(f1()); //11 console.log(f1()); //11 console.log(f1()); //11
函数模式的闭包
//函数模式的闭包 function f2() { var num = 10; return function () { num++; return num; } } var ff = f2(); console.log(ff());//11 console.log(ff());//12 console.log(ff());//13