//共有var SunHang = function(){ var name = "ssss"; this.name = "hhhhh"; function getName(){} this.getName = function(){ return this.name; }}var aaa = new SunHang()aaa.getName() //hhhhh//私有var SunHang = function(){ var name = "ssss"; this.name = "hhhhh"; function getName(){} this.getName = function(){ return name; }}var aaa = new SunHang()aaa.getName() //ssss