2018年10月3日

js实现继承的几种方式

摘要: // 定义一个动物类 function Animal (name) { // 属性 this.name = name || 'Animal'; // 实例方法 this.sleep = function(){ console.log(this.name + '正在睡觉!'); } } // 原型方法 Animal.prototype.eat = function(fo... 阅读全文

posted @ 2018-10-03 16:54 防空洞123 阅读(106) 评论(0) 推荐(0) 编辑

导航