zoukankan      html  css  js  c++  java
  • prototype、constructor、__proto__

     1 function Person() {
     2         }
     3 
     4         Person.prototype.name = "Nicholas";
     5         Person.prototype.age = 29;
     6         Person.prototype.job = "Software Engineer";
     7         Person.prototype.sayName = function () {
     8             console.log(this.name);
     9         };
    10 
    11         var person1 = new Person();
    12         person1.sayName();
    13 
    14         var person2 = new Person();
    15         person2.sayName();
    16 
    17         console.log(person1.sayName == person2.sayName);//函数相等
    18         console.log(Person.constructor);
    19         console.log(Person.prototype.constructor);
    20         console.log(person1.__proto__);
    21         console.log(person2.__proto__);

  • 相关阅读:
    MySQL学习笔记
    FileInputStream
    Java 多个if 和多个else if 的区别
    Flume 聚合
    Flume SinkProcessor
    Flume ChannelSelector (包括自定义flume拦截器)
    Flume 案例演示
    為政第二
    各种版本 WordCount
    學而第一
  • 原文地址:https://www.cnblogs.com/qzsonline/p/2417981.html
Copyright © 2011-2022 走看看