你的foo构造器里面定义的函数是局部私有的,应该把他们定义到this上
function foo() {
this.sayHello=function(){ console.log('hello'); }
this.sayWTF=function(){ console.log('WTF'); }
}
function foo() {
this.sayHello=function(){ console.log('hello'); }
this.sayWTF=function(){ console.log('WTF'); }
}
