- Create Constructor Functions
- Add methods to a constructor function
- Create objects from constructor function
We're tutoring a high school student in US History, and they have to memorize all the presidents of the United States, and relevant information. You want to make studying fun, so you plan to build a little app to help quiz them. For now, we're just going to build out the database.
In index.js
, build an ES6 President
class with following properties set by the constructor: name
, politicalParty
, yearsInOffice
, and homeState
.
Add following methods to the class:
-
veto
- returns "NO!" -
passBill
- returns "You can do that!" -
doCharity
- returns "I like to help people." -
conductPressInterview
- returns "I am proud to be an American" -
sayHi
- returns "Hi, my name is . I am from . I represent the s and was in office ."
Then create the following presidents: George Washington, Abraham Lincoln, Richard Nixon, and Jimmy Carter.