I am now taking an advanced JavaScript programming class. My hope was to finally understand the prototype concept at a deep level. The first two weeks of class were supposed to be a review. We flew through many chapters of the textbook. By chapter 8, the book had covered prototypes. However the meaning was not totally clear. I asked my instructor before class some questions on prototypes. He said he never heard of them. I am doomed.
Okay. Here is the deal. The book made it sound like prototypes point to the parent objects of your new object. This is some type of quasi-inheritance. I can get that. When JavaScript tries to resolve a method or property, it looks to the current object. If it cannot find the name it is looking for, JavaScript will climb up one level to your object's prototype. Good enough.
My instructor told me to play with some code to figure this stuff out. Normally that is good advice. But the whole point of me taking this class was that someone in the know could guide me. Looks like I am out of luck on that front. So I define a function that is a constructor. Then I create an instance of that object using the new() keyword which invokes the constructor. I try to print out the prototype of my new object. Nothing is there. WTF?
I would have though that an object I created without any explicit prototype settings would have a prototype of Object. Does not look like that is the case. I need to find a mentor. Or I could buckle down and stufy up. Sometimes you just got to make do yourself.
Free Laundry
-
Apparently a lot of apartment buildings have coin operated laundry machines
in the basement. And guess what? You can order a key to unlock the payment
me...