摘要:
prototype可以把那些固定的属性和方法,直接定义在prototype身上var Cat = function(name,color){ this.name = name; this.color = color;}Cat.prototype = { type:"猫科", eat:function(){ alert("吃老鼠"); } }//生成实例var cat1 = new Cat("大毛","黄色");var cat2 = new Cat("八路","灰色"); al 阅读全文