Challenges are optional exercises that you should attempt only if you've completed the practice exercises and understand the concepts.
You have volunteered your time to a local political candidate, Elizabeth Sanger, who wants to become a US representative in Congress for your district. Unfortunately, the team discovered that you're a software developer, so they have begged you to build an application that lets them track volunteers, and store information about Elizabeth and her campaign.
Your job is to define the different objects and arrays, their structure, and the corresponding properties for each, to represent the following information about Elizabeth's campaign.
- Her congressional district (you can use yours here)
- Her platform statements for the following issues.
- Taxes
- Jobs
- Infrastructure
- Health care
- Crime and enforcement
- URL for donation form
- Calendar of events
- Volunteer information
- Name
- Address
- Phone number
- Availability
- What activities each one is willing to do (e.g. answering phone calls, taking polls, etc.)
- Biography
- Image gallery
- Head shot
- Picture of family
- Picture of constituents
- Mission statement
- URL for registering to vote
Advanced challanges are intended to be difficult and the expectation is for you to use your imagination, and research skills to make your own decisions about which code should be written.
After you have defined all the objects for representing the data about Elizabeth's campaign, write a corresponding function for each one whose purpose is to change the state of the object. Then use your functions to modify the existing data.
Things to think about.
- Am I modifying an array? Then the function argument should be added to the target array with the
push()
method. - Am I modifying an object? Then I should pass both the key name to be modified, and its corresponding value.
This challenge is for you to practice writing functions, so the more you can write, the better. It helps make neural connections in your brain at this point since you're still building your software vocabulary.
Example:
function addToImageGallery (newImage) {
...
}
function changeBiography (newBiography) {
...
}
function changePlatform (topic, newPlatformStatement) {
...
}