继承

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <script>

        function People(name){


            this.name=name;

        }

        People.prototype.showName=function(){


            console.log(this.name);

        }

        function Student(){

        }

        Student.prototype.study=function(){

            console.log("学习");
        }

        var stu=new Student();
       // stu.study();
       //// stu.showName();
//Student.prototype
        //console.dir(stu._proto_===Student.prototype)

        //console.dir(Student.prototype._proto_===People.prototype)
        //console.dir(stu._proto_._proto_===People.prototype)
        console.dir(stu._proto_._proto_._proto_._proto_)
        console.dir(People.prototype._proto_._proto_._proto_)

        //Student.prototype
        //People.prototype

       // function
    </script>
</head>
<body>
   
</body>
</html>
posted @ 2021-11-17 17:28  张慧琳666666  阅读(30)  评论(0)    收藏  举报