您当前的位置: 首页 > 

暂无认证

  • 4浏览

    0关注

    92582博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

JS中继承方式2

发布时间:2020-08-18 00:17:30 ,浏览量:4

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <script> function Person(myName, myAge) { //let per=new Object(); //let this=per; //this=stu; this.name = myName; // stu.name = myName; this.age = myAge; // stu.age = myAge; this.say = function () { // stu.say = function () {} console.log(this.name, this.age); } // return this; } function Student(myName, myAge, myScore) { //let stu=new Object(); //let this=stu; Person.call(this,myName,myAge); this.score=myScore; this.study=function() { console.log("day day up"); } //return this; } let stu=new Student("cyg",66,666); // stu.name = "zs"; //stu.age = 18; //stu.score = 99; //console.log(stu.score); stu.say(); stu.study(); </script> </body> </html> 
关注
打赏
1653961664
查看更多评论
立即登录/注册

微信扫码登录

0.0767s