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. java 文件字符输入、输出流

    Example10_6.java import java.io.*; public class Example10_6 { public static void main(String args[]) ...

  2. apache-tomcat-7.0.70无法进入Manager管理App项目

    在tomcat文件夹找到conf文件夹中的tomcat-user.xml文件,用记事本打开,在最下面可以看到tomcat默认把用户注释掉了,也就是说打开tomcat主页是进不去管理页面的.方法如下:找 ...

  3. #ifndef 和 #endif

    文件中的#ifndef 头件的中的#ifndef,这是一个很关键的东西.比如你有两个C文件,这两个C文件都include了同一个头文件.而编译时,这两个C文件要一同编译成一个可运行文件,于是问题来了, ...

  4. 用cas来实现php的单点登陆

    最近项目中需要做单点登录,客户端包含Java.ruby和PHP,java有几个应用程序,php是discuz+supesite+ucenter,配置步骤如下: 1.cas服务端:下载地址:http:/ ...

  5. sphinx分域搜索

    http://stackoverflow.com/questions/2526407/complex-query-with-sphinx 比如要实现和如下sql代码相同的功能: SELECT * FR ...

  6. 教你用CSS代码写出的各种形状图形

    做网页设计时经常要用到各种形状的图形,对于规则的图形很简单,但是对于不规则的图形,一般我们都是用图片,今天就在这里教大家怎样用css代码写出各种规则不同的图形 1.正方形 #square {width ...

  7. 链表基础 HDU1267

    基础的链表,模拟一下就好了...就签个到

  8. byte[]和InputStream的相互转换

    1:byte[]转换为InputStream InputStream sbs = new ByteArrayInputStream(byte[] buf); 2:InputStream转换为Input ...

  9. 细菌(disease)

    细菌(disease) 题目描述 近期,农场出现了D(1≤D≤15)种细菌.John要从他的N(1≤N≤1000)头奶牛中尽可能多地选些产奶,但是如果选中的奶牛携带了超过K(1≤K≤D)种不同细菌,所 ...

  10. vs2005中分割线怎么插入

    用Label控件,将Label控件的AutoSize设为False,然后清除Text属性,再将BorderStyle属性设为Fixed3D,宽度设为2个像素,就可以成为分割线. 效果: