Prototype Framework Question: Download Prototype PDF

What is the exact purpose of this ".prototype" property?

Tweet Share WhatsApp

Answer:

The interface to standard classes become extensible. For example, you are using the Array class and you also need to add a custom serializer for all your array objects. Would you spend time coding up a subclass, or use composition or ... The prototype property solves this by letting the users control the exact set of members/methods available to a class.

Think of prototypes as an extra vtable-pointer. When some members are missing from the original class, the prototype is looked up at runtime.

Download Prototype PDF Read All 7 Prototype Questions
Previous QuestionNext Question
How does the new keyword works?What is Prototype JavaScript Framework?