search

Home  >  Q&A  >  body text

javascript - How to understand the sentence that the constructor is the unique identifier of the prototype? What's the meaning

How do you understand the sentence that the constructor is the unique identifier of the prototype? What's the meaning

phpcn_u1582phpcn_u15822805 days ago546

reply all(1)I'll reply

  • 为情所困

    为情所困2017-05-19 10:16:57

    Why are you talking all these nonsense? . . . . That is to say, the position of an object in the prototype chain depends entirely on the function. This is the only thing that comes to my mind that may be correct. The prototype chain is actually composed of the prototype属性构成的链表,一个对象通过原型链继承其他的属性。可能因为这是一个构造函数的prototype attribute of the function, so that's what he said. But this is really not necessarily right, for example

    function fn(){}
    function fn2(){}
    
    fn2.prototype=fn.prototype;
    a = new fn();
    fn.prototype = {};
    
    console.log(a instanceof fn)  // false
    console.log(a instanceof fn2) // true

    About the prototype chain, take a look at this: http://zonxin.github.io/post/...

    reply
    0
  • Cancelreply