摘要: function Cat(name,age){ this.name = name this.age= age } //机制1:每一个函数对象都有一个prototype对象 console.log(Cat.prototype) //node输出: {} Cat.prototype.get_name = function(){ return this.name } //机制2:new关键字+构造函数 阅读全文
posted @ 2019-10-14 00:37 心中有一海 阅读(753) 评论(0) 推荐(1) 编辑