Object Methods in JS Lab
Objectives
- Create constructor functions
- Add methods to a constructor function
- Create objects from a constructor function
Instructions
Scuber, in an effort to gain much needed local influence, has begun adding some powerful board members to its organization. It expects to add more (similar) board members in the future, so it needs you to declare a constructor function so that it can crank them out.
In index.js
, write a constructor function called BoardMember
that sets the following properties: name
, homeState
, and training
.
Add following methods to the class:
-
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>.
Does this need an update?https
Please open a GitHub issue or pull-request. Provide a detailed description that explains the issue you have found or the change you are proposing. Then "@" mention your instructor on the issue or pull-request, and send them a link via Connect.
View Object Methods Lab on Learn.co and start learning to code for free.
PHRG Object Methods in JS Lab