var Rabbit = (function(){
var rabbitNum = 0;
return function(myName,myFaveriteFood,myAddress){
var name, food, address;
function checkPassword(){
console.log("password:123");
}
this.setName = function(newName){
name = newName;
}
this.getName = function(){
return name;
}
this.setFood = function(newFood){
food = newFood;
}
this.getFood = function(){
return food;
}
this.setAddress = function(newAddress){
address = newAddress;
}
this.setAddress = function(){
return address;
}
this.check = function(){
checkPassword();
}
rabbitNum++;
this.seeNumber = function(){
console.log("rabbitNum="+rabbitNum);
}
this.setName(myName);
this.setFood(myFaveriteFood);
this.setAddress(myAddress);
}
})();
Rabbit.prototype.sayHello = function(){
console.log("hello, my name is " + this.getName());
}
Rabbit.prototype.checkP = function(){
this.check();
}
Rabbit.eatBreakfast = function(){
console.log("all rabbits are eating");
}
var rabbit = new Rabbit("Emily","apple","Earth");
var rabbit2 = new Rabbit("Hellen","water melon","Earth");
rabbit.sayHello();
rabbit.seeNumber();
Rabbit.eatBreakfast();