function Create(name){
this.name= name;
this.show = function(){
alert(this.name);
};
}
var obj = new Create('张三');
var obj1 = new Create('李四');
alert(obj1.show == obj.show); //false;
function Create(name){ //构造方法
this.name = name; //变动的东西放在构造函数中
}
Create.prototype.show = function(){//prototype 原型
alert(this.name); //不变的东西房子原型里
};
/*var obj = new Create('张三');
var obj1 = new Create('李四');
alert(obj1.show == obj.show); true *///调用的同为原型里的show方法,在内存中只存在一份