封装
类名首字母大写
this + prototype
var Cat ={
name:'';
color:'';
}
/**
* this
*/
var Cat=function(name,color){
this.name = name;
this.color = color;
}
/**
*prototype
*/
Cat.prototype.type = "猫科动物";
Cat.prototype.eat = function(){alert("吃老鼠")};
var cat1 = new Cat('haha','xxx');