zoukankan      html  css  js  c++  java
  • JS原型,原型链(草稿2)

    1 上一片草稿思路太混乱, 重新整理一下思路。

    1对象。 首先我们还是找对象。对象的创建方法有几种?

    1 new Object  2  字面量 3 构造函数。

    var student1 = new Object();
    var student2 = {};
    function Student(){}
    var student3 = new Student();
    console.log(student1);
    console.log(student2);
    console.log(student3);
    第一个和第二个的结果相同,如下:

    第三个的结果:

     __proto__里面的是什么呢?

     看一下他们的关系。我的天哪。

    console.log(student3.__proto__.__proto__ == student2.__proto__);

     

    2 函数。构造函数:

     这个构造函数的属性是否,和对象里面的__pro__一样呢?

    console.log(student3.__proto__ == Student.prototype);

    
    

    再根据已知的。
    console.log(Student.prototype.constructor == Student);

    
    


  • 相关阅读:
    idea database testconnection 显示灰色
    idea tomcat热部署
    idea 常见报错问题 记录
    Python-Basis-22th
    Python-Basis-21th
    Python-Basis-20th
    Python-Basis-19th
    Python-Basis-18th
    Python-Basis-17th
    Python-Basis-16th
  • 原文地址:https://www.cnblogs.com/hacker-caomei/p/14140010.html
Copyright © 2011-2022 走看看