The single object instantiated above has three properties, one being a function. Creating a second object with a very similar structure makes OO developers everywhere cringe:
Creating our own prototype lets us use any object as the prototype. The realization that __proto__ is just a normal object and we are able to do normal “object” stuff with it allows us to use it to solve the earlier code reuse problem. In the example below, we simply assign the prototype from driverlicense1 to the __proto__ property of driverslicense2. Now both instances of the driverslicense can share the implementation of the show method.
Written by Todd Wright
We offer private, customized training for 3 or more people at your site or online.
Our live, instructor-led lectures are far more effective than pre-recorded classes
If your team is not 100% satisfied with your training, we do what's necessary to make it right
Whether you are at home or in the office, we make learning interactive and engaging
We accept check, ACH/EFT, major credit cards, and most purchase orders
New York City
Salt Lake City