zoukankan      html  css  js  c++  java
  • js原型链

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>原型链</title>
    </head>
    <body>
        <script>
            function Star(name,age) {
                this.name =name;
                this.age =age;
            }
            Star.prototype.sing = function () {
                console.log('我会唱歌')
            }
            var ldh = new Star('马云',18);
            // 1.只有是对象就要__proto__原型,指向原型对象
            console.log( Star.prototype)
            console.log( Star.prototype.__proto__ === Object.prototype)
            // 2. Star原型对象里面的__proto__原型指向的是Object.prototype
            console.log(Object.prototype.__proto__)
            //3.我们  Object.prototype原型对象里面的__proto__原型 指向为null
    
        </script>
    </body>
    </html>

    运行结果

  • 相关阅读:
    os模块
    random模块
    datetime模块
    time模块
    软甲开发目录规范
    模块与包
    函数递归
    内置函数
    【NOIP2016提高组】换教室
    【NOIP2015提高组】运输计划
  • 原文地址:https://www.cnblogs.com/malong1992/p/12831267.html
Copyright © 2011-2022 走看看