Kyle Simpson: Firstly, what is a constructor?
Speaker 2: A property.
Kyle Simpson: What's that?
Speaker 2: A property.
Kyle Simpson: I thought you said problem. I would agree, it is a problem. What is a constructor? It is a function that is called with the new keyword in front of it. Dot constructor is a property but a constructor, a constructor call, is a function that has the new keyword in front of it, that's it.
What is bracket bracket prototype? What is that prototype linkage and where does it come from?
Speaker 2: When it's the prototype of the constructor used to create the object?
Kyle Simpson: Sort of, bracket bracket prototype is a linkage from one object to another object. Where it comes from, there's two different ways that we've seen.
We can get that linkage from object create, which just links it to another arbitrary object or we can get it indirectly as step two of the four steps of the new keyword. But either way, we end up with one object linked to another object.
Kyle Simpson: Everybody following so far?
Kyle Simpson: How does a that prototype mechanism, how does it affect on how we deal with an object?
Speaker 2: Similar to a lexical scope, where you can go up to the next object.
Kyle Simpson: So we can call a property or method on an object reference and if it can't handle that property or method reference, it delegates up the prototype chain to a different object.
It's an amazingly powerful mechanism, this delegation thing that we're getting to, the fact that we can have the object can almost be a fallback object. But the fact that we can delegate from one object to another object is a powerful pattern. You notice in all of this, I haven't described anything about copying the order but we'll come back to copying.
How do we find out about where an object's prototype, where that prototype's linkage points to? There were three ways that we figured it out? We're given a1 or b1, how do we find out where these prototypes link to?
Speaker 2: Thunderproto.
Kyle Simpson: Thunderproto.
Speaker 2: Utility prototype o.
Kyle Simpson: Object of prototype o.
Now what was that third property?
Speaker 2: Prototype.
Kyle Simpson: Dot constructor dot prototype.
Kyle Simpson: All right, just as a reminder, I said that this keyword works really nicely. But just as a reminder, we still have exactly the same problems with our this bindings that we did before when we were only talking about this keywords.
If you take a1.speak and you pass it into a click handler all by itself, what's going to happen to it is this reference.
Kyle Simpson: jQuery is going to force it to be the button rather than our a1 object. You still have the same problem where you need to deal with dot bind, hard bindings or whatever.