- Refactor code to use prototypes
- Ensure that each method is only declared one time yet can be referenced by the newly created objects
With our new knowledge of prototypes, we would like to refactor our previously written code to declare each function only one time. So, your task is to take our existing code and refactor it using prototypes.
In index.js
, BoardMember
constructor function with the following properties set by the constructor: name
, training
, and homeState
.
Add following methods to the prototype of the constructor:
-
veto
— returnsNo, I must disagree
-
approve
— returnsYou can do that!
-
doCharity
— returnsI like to help people.
-
releasePressStatement
— returnsYou will see great things from Scuber.
-
sayHi
— returns"Hi, my name is <name>. I am from <homestate>, and I was trained in <training>.
View Prototypes Lab on Learn.co and start learning to code for free.