摘要:
1 var obj = { 2 name: "heihei", 3 age: 18 4 } 5 var info = Object.create(obj, { 6 address: { 7 value: "成都", 8 enumerable: true 9 } 10 }) 11 12 functio 阅读全文
posted @ 2022-03-20 19:23
沁霓
阅读(41)
评论(0)
推荐(0)
摘要:
关于继承最佳实现就是 寄生组合函数继承 具体看实例 1 function inheritProtoType(subType, superType) { 2 subType.prototype = Object.create(superType.prototype) 3 Object.definePr 阅读全文
posted @ 2022-03-20 14:53
沁霓
阅读(87)
评论(0)
推荐(0)
摘要:
前边继承虽然我们也 var p=new Person() Student.prototype=p 但是这种方式会在new Person()的时候执行Person,会有很多弊端 这里我们采用使用原型式继承函数,来创建类似于之前的p,但是有点是,不用多次去调用函数,直接举例子 1 var obj = { 阅读全文
posted @ 2022-03-20 12:11
沁霓
阅读(52)
评论(0)
推荐(0)

浙公网安备 33010602011771号