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

    <!DOCTYPE html>
    <html lang="en">
    <head>
      <meta charset="UTF-8">
      <title>Document</title>
    </head>
    <body>
      <script type="text/javascript">
    
      var person = function (name) {
        this.name = name;
      };
      person.prototype.getName = function() {
        return this.name;
      };
    
      var student = new person('jerome');
    
      console.log(student); // person { name: 'jerome' }
      console.log(student.prototype); //undefined, 对象原型没有prototype
      console.log(student.__proto__); // person {}
    
      console.log(person); // function person(name)
      console.log(person.prototype); // person {}
      console.log(person.__proto__); // function Empty()
      console.log(person.prototype.prototype); // undefined
      console.log(person.prototype.__proto__); // Object {}
    
      console.log(Object.prototype); // Object {}
      console.log(Object.__proto__); // function Empty()
    
      console.log(Function.prototype); // function Empty()
      console.log(Function.__proto__); // function Empty()
    
      console.log(Object.prototype.prototype); // undefined
      console.log(Object.prototype.__proto__); // null
    
      console.log(Function.prototype.prototype); //undefined
      console.log(Function.prototype.__proto__); // Object {}
    
      // 结论:
      // student.__proto__ = person.prototype
      // person.prototype.__proto__ = Object.prototype
      // Object.prototype.__proto__ = null
      </script>
    </body>
    </html>
    

      

  • 相关阅读:
    十四、oracle 数据库管理--管理表空间和数据文件
    十一、oracle 数据库管理员
    十二、oracle 数据库(表)的逻辑备份与恢复
    九、oracle 事务
    十、oracle 常用函数
    八、oracle 分页
    七、oracle 表查询二
    五、oracle 表的管理
    六、表查询一
    四、oracle 用户管理(Profile)
  • 原文地址:https://www.cnblogs.com/linji/p/4727894.html
Copyright © 2011-2022 走看看