Week 4 - Session 1 - Constructor and Prototype
Creating multiple objects can be repetitive/tedious. It’s easy to make mistakes when creating new objects, and storing the same method over and over for every object is inefficient. This is where Constructor and Prototype come in.
Constructor - blueprint for what properties our object will have. When we create an instance of our object, it will have these properties with values set (in this case, from the parameters).
Prototype - blueprint for what methods our instance objects will have access to. Any instances of the object will look to their prototype for methods.
Javascript Constructors and Prototypes - http://tobyho.com/2010/11/22/javascript-constructors-and/
Stack Overflow (Trying to understand the difference between prototype and constructor in JavaScript) - https://stackoverflow.com/questions/28600238/trying-to-understand-the-difference-between-prototype-and-constructor-in-javascr
Stack Overflow (JavaScript inheritance and the constructor property) - https://stackoverflow.com/questions/8093057/javascript-inheritance-and-the-constructor-property
Constructor - blueprint for what properties our object will have. When we create an instance of our object, it will have these properties with values set (in this case, from the parameters).
Prototype - blueprint for what methods our instance objects will have access to. Any instances of the object will look to their prototype for methods.
Javascript Constructors and Prototypes - http://tobyho.com/2010/11/22/javascript-constructors-and/
Stack Overflow (Trying to understand the difference between prototype and constructor in JavaScript) - https://stackoverflow.com/questions/28600238/trying-to-understand-the-difference-between-prototype-and-constructor-in-javascr
Stack Overflow (JavaScript inheritance and the constructor property) - https://stackoverflow.com/questions/8093057/javascript-inheritance-and-the-constructor-property