![]() valueOf is actually an object prototype method! Why do we have access to this method on a string as well? What is happening?! Strange…this isn’t a method we created on our Instructor class. valueOf () // "The prototype chain is super cool!" In JavaScript, a prototype is a special object that is assigned to all functions, including but not limited to functions that are used to construct objects.Ĭlass Instructor // Example #2 let message = ' The prototype chain is super cool! ' message. We know that we have access to prototype methods (forEach, filter, etc) on arrays.We know that a prototype is a model of something and how it should look or behave.What do we know about this so far? Review Where have we heard the term prototype before. _proto_ Also called “dunder-proto”, this allows us to access the ].] A hidden link on every object that links objects to one another, allowing objects to share behaviors.prototype A special object which is assigned to functions that you make in JavaScript.Understand and explain how prototypal inheritance works via the prototype chain.Speak to and understand the difference between prototoype and _proto_.By the end of this lesson, you will be able to:
0 Comments
Leave a Reply. |