Question: Create a for loop that loops through the contents of the race array using i as the counter variable. Place the commands specified in the

Create a for loop that loops through the contents of the race array using i as the counter variable. Place the commands specified in the following steps within this program for loop: Create a variable named totalVotes that will store the total votes cast in each race. Set its initial value to 0. Calculate the total votes cast in the current race by applying the forEach() method to i index of the votes array using the calcSum() function as the callback function. Add the following HTML text to the value of the reportHTML variable to write the name of the current race in the program loop where race is the i index of the race array. Call the candidateRows() function (you will create this function shortly) using the counter variable i and the totalVotes variable as parameter values. Add the value returned by this function to the value of the reportHTML variable. Add the text

race
Candidate Votes

to the value of the reportHTML variable. After the for loop has completed, write the value of the reportHTML variable into the innerHTML of the first (and only) section element in the document.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!