摘要: function Cat(){ this.name = "大毛";} //构造函数var cat1 = new Cat(); //实例化Cat.prototype.eat = function(){} //添加方法 2.Object.create()法“类”就是一个对象,不是函数var Cat = { name: "大毛", makeSound :function(){alert('喵喵喵')}};var cat1 = Object.cre... 阅读全文
posted @ 2013-12-25 16:44 100bluesea 阅读(1044) 评论(0) 推荐(0) 编辑
摘要: var Cat = { name :'', color :'' }var cat1 = { cat1.name = "大毛"; cat1.color = "黄色";}Cat作为一个对象,有名字和颜色两个属性function Cat(name,color){ return{ name:name, color:color ... 阅读全文
posted @ 2013-12-25 11:58 100bluesea 阅读(234) 评论(0) 推荐(0) 编辑