1. 主页
  2. 文档
  3. JS
  4. 面向对象
  5. 原型链的终点

原型链的终点

<!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>
</head>

<body>


    <script>
        function ren(name, age, sex) {
            this.name;
            this.sex;
            this.age;

            this.shuohua = function() {

            }
            this.zoulu = function() {

            }
        }
        var nren = new ren();
        //原型终点  Object.prototype  和  nren.__proto__.__proto__
        console.log(nren.__proto__.__proto__ === Object.prototype);


        //关于数组的原型链
        var arr = [11, 22, 33, 44, 55, 66];
        console.log(arr.__proto__ === Array.prototype);
        console.log(arr.__proto__.__proto__ === Object.prototype);
    </script>
</body>

</html>
这篇文章对您有用吗?

我们要如何帮助您?