Teamwork Challenges - One of the newer guys on the team asked our project manager for some info. He needed to figure out how to get his scripts logging in to run unattended. Th...
Here is a true statement: All objects have prototypes. The default prototype only has the constructor. The constructor assigns the prototype to an object instance at the time of instance creation. You can retrieve this prototype by calling getPrototypeOf() or by accessing __proto__.
When you add properties to an instance, only that instance gets the properties by default. However you can use the prototype keyword before the property. That causes the property to apply to all instances of the obect. To be more specific, any instances created by the object will get the new properties added when the properties are qualified by the prototype keyword. Wow. That was a mouthful.
Now the prototype is itself an object. Therefore the prototype has a prototype. Let's not get too bogged down by that though. You can use prototype on your own objects. However you can only change a prebuilt object with prototype if the object was created with the "new" keyword.