Congratulations, you made it to the end of the course! Northbank Tool Library’s loan kit model now runs in JavaScript. The checkout app prints the same seven lines as the Python module. They start with audit[tag[KIT-17: drilling]] and the drilling kit’s tools, listed twice, and run through PRINT audit[tag[KIT-17: drilling]] to Tool count: 5.
Getting there meant finding a new home for each piece of Python’s object model. Python looks up attributes through classes and an MRO. JavaScript follows links between objects, and the classes you write build those links for you.
In this course, you learned how to:
- Follow a property read from an object’s own properties up its prototype chain to
Object.prototypeandnull - Tell a constructor apart from its
.prototypeobject and read a class as the objects it builds - Predict where
superstarts looking, whatever object receives the call - Keep an inherited setter in the loop by assigning after
super()instead of declaring a field - Use a well-known symbol such as
Symbol.iteratoronly when its meaning is clear and honor its contract - Choose between a cooperative class layer and a part the object holds
Follow One Link at a Time
A property read checks the object’s own properties first, then follows one link at a time until it finds the name or reaches null. A missing property reads as undefined rather than raising an AttributeError. Nothing is copied along the way, so changing kind on the defaults object reached the drilling kit at once. A plain assignment, by contrast, created an own property on the drilling kit, hiding the inherited one.