function test(){ var a = 100; this.b = 200; //私有方法 function getMax(){ alert(1); } //公有方法 this.getMin = function (){ alert(2); } } var obj = new test; obj.b; obj.getMin();//公有方法可以调出,值为2 //obj.getMax();//私有方法调不出