2012年12月27日
摘要: 1 //类定义(prototype 模式) 2 function Cat(name,color) { 3 this.name = name; 4 this.color = color; 5 } 6 Cat.prototype.type = 'cat'; 7 Cat.prototype.food = 'fish'; 8 Cat.prototype.eat = function() { 9 alert(this.name + ' is eating '+this.food);10 };11 12 //使用13 var cat1 = new Cat(& 阅读全文
posted @ 2012-12-27 11:58 Cloud Lee 阅读(376) 评论(11) 推荐(2) 编辑