The code is structured in seven functions.
buildDropdown()
This function builds the drop down menu using eventData and calls on other functions to display
information
on the page depending on what the user selects in the dropdown menu.
displayStats(eventsArray)
This function displays the event stats on the page, specifically the total, average, most and least.
It also
works to display these values as whole numbers rather than decimals.
calculateStats(eventsArray)
This function calculates the attendance. It calculates the total, average, most and least
attendance depending on the data that is passed into the function. It then returns
the calculated stats.
displayEventData(eventsArray)
This function displays the event data in a table using a template provided
in the html. Each different piece of data is passed into the table and displayed
properly.
getEventData()
This function gets the event data that's being stored locally on the user's browser.
It then returns the data as currentEvents.
getEvents(element)
This function takes the provided events and then filters them depending on filters set by the user.
saveEventData()
This function saves each piece of data locally so that the user may use it again in the
future.