SOURCE

// js中大量的用到了闭包的思想,
// 如 节流防抖,单例模式,genertor
function Outerfunc(){
  var num =0;
  this.runNum = function(){
    num ++;
  }
this.getNum = function(){
  return num;
}
}
var outerfunc = new Outerfunc();
outerfunc.getNum();//0

outerfunc.runNum();
outerfunc.getNum();//1
console 命令行工具 X clear

                    
>
console