1.function 和object 都有 constructor 和prototype

2. var a=new Animal() (animal 是function或Object) a 有 constructor  没有 prototype, a的constructor 是animal.prototype.constructor

3.实例化的function 和Object 都有 constructor   是指向  被实例化的 prototype.constructor

如 var a=new Animal();  // a.constructor===Animal.prototype.constructor  true      a 没有prototype  (function)

var o =new Object() ;//obj.constructor===Object.prototype.constructor  true    o 没有prototype    (Object)

4.Animal.constructor 是function(){}   Animal.prototype.constructor是本身函数

function Anmal(name)

{

this.name=name;

}

Animal.constructor是

function Function() {
    [native code]
}

Animal.prototype.constructor 是

function Animal(name) {
            this.name =name
       
        }

js prototype 和constructor的更多相关文章

  1. 【JavaScript】关于JS中的constructor与prototype

    最初对js中 object.constructor 的认识: 在学习JS的面向对象过程中,一直对constructor与prototype感到很迷惑,看了一些博客与书籍,觉得自己弄明白了,现在记录如下 ...

  2. js——prototype、__proto__、constructor

                                       Object                                    1. Object是一个函数(typeof O ...

  3. js中prototype,constructor的理解

    连看4篇前辈的文章,记录一些知识点 Javascript继承机制的设计思想 Javascript 面向对象编程(一):封装 Javascript面向对象编程(二):构造函数的继承 Javascript ...

  4. 【推荐】关于JS中的constructor与prototype【转】

    最初对js中 object.constructor 的认识: 在学习JS的面向对象过程中,一直对constructor与prototype感到很迷惑,看了一些博客与书籍,觉得自己弄明白了,现在记录如下 ...

  5. 关于JS call apply 对象、对象实例、prototype、Constructor、__proto__

    关于call与apply的理解容易让人凌乱,这里有个方法可供参考 tiger.call(fox,arg1,arg2...) tiger.apply(fox,[arg1,arg2...]) 理解为 fo ...

  6. js中prototype和constructor的认识

    最初对js中 object.constructor 的认识: 我们都知道,在JS中有一个function的东西.一般人们叫它函数.比如下面的代码 function Person(name)    {  ...

  7. JS中关于构造函数、原型链、prototype、constructor、instanceof、__proto__属性

    在Javascript不存在类(Class)的概念,javascript中不是基于类的,而是通过构造函数(constructor)和原型链(prototype chains)实现的.但是在ES6中引入 ...

  8. js in depth: arrow function & prototype & this & constructor

    js in depth: arrow function & prototype & this & constructor https://developer.mozilla.o ...

  9. js in depth: Object & Function & prototype & __proto__ & constructor & classes inherit

    js in depth: Object & Function & prototype & proto & constructor & classes inher ...

随机推荐

  1. Node.js学习 - Global Object

    全局对象:特殊的对象,它及其所有属性都可以在程序的任何地方访问. __filename 表示当前正在执行的脚本的文件名.它将输出文件所在位置的绝对路径,且和命令行参数所指定的文件名不一定相同. 如果在 ...

  2. android 5.0新特性学习--RecyclerView

    在过去很多年,我们的PC或者手机设备都是采用拟物化的设计风格,IOS采用扁平化的特性,android在2014年IO大会上说采用Material Design的设计风格,显示效果不能过于生硬的转换,而 ...

  3. PAT (Advanced Level) 1108. Finding Average (20)

    简单模拟. #include<cstdio> #include<cstring> #include<cmath> #include<vector> #i ...

  4. angularjs三级联动

    <div ng-controller="AjaxCtrl"> <h1>AJAX - Oriented</h1> <div> Coun ...

  5. 解决phpmyadmin上传文件大小限制的配置方法(转)

    phpmyadmin导入SQL文件时涉及到phpmyadmin上传文件大小限制问题,默认phpmyadmin上传文件大小为2M,如果想要 phpmyadmin上传超过2M大文件,就需要修改phpmya ...

  6. postfix+dovecot配置多域名邮件服务器

    mail邮局系统的MX(邮件交换)记录配置,以便收发邮件.(MX记录,是邮件交换记录,它指向一个邮件服务器,用于电子邮件系统发邮件时根据收信人的地址后缀来定位邮件服务器,如果没有做域名解析,邮局不能正 ...

  7. C++零食:使用Unicode版的预定义宏__FUNCTION__

    在C++中支持一种预定义宏.比如: __FILE__: 就是当前源代码文件名 __LINE__: 就是当前源代码的行号 这些宏可以在printf等语句中直接作为字符串使用,调试的时候很方便. 如下代码 ...

  8. gen_create_syn.sql

    set echo off feedback off verify off pagesize 0 linesize 120 ---变量从 sqlplus 的 call代码 传递过来 . -- 1 表示连 ...

  9. Hibernate用Oracle的sequence生成自增Id

    <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE hibernate-mapping PUBL ...

  10. CentOS6.5 添加epel源

    0.安装yum优先级插件 yum install yum-priorities 1.epel简介: https://fedoraproject.org/wiki/EPEL/zh-cn rpm -Uvh ...