prototype 原型对象继承

a继承b

<script>


function b(){
this.bname = "99";
}


function a(){
this.aname = "5";
}


a.prototype = new b();
a.prototype.cname = "66";

var a = new a();

console.log(a.aname); //5
console.log(a.bname); //99
console.log(a.cname); //66

</script>

posted @ 2021-07-19 09:33  qcjdp  阅读(22)  评论(0编辑  收藏  举报

Bill

Jerry

Evil