56.2k views
5 votes
Open the list10-2.js file and directly below the code populating the links array, declare the htmlCode variable. Store within the variable the following text:

Movie Description Score




Open the list10-2.js file and directly below your previous code create a for loop with a counter variable i that goes from 0 to 9. Each time through the for loop add the following text to the htmlCode variable:


titles_i
summaries_i
ratings_i


where i is the value of the counter variable, and links_i, titles_i, summaries_i, and ratings_i are the values from the links, titles, summaries, and ratings array with index number i.

After the for loop add the following text to the htmlCode variable:



Store the value of the htmlCode variable in the inner HTML of the element with the ID list.

User Facetoe
by
7.7k points

1 Answer

3 votes

Answer:

Sure, here is the code you requested:

```

```

// Declare the htmlCode variable

var htmlCode = `

Movie Description Score

`;

// Create a for loop with a counter variable i that goes from 0 to 9

for (var i = 0; i < 10; i++) {

// Add the following text to the htmlCode variable

htmlCode += `

<div>

<h3>${titles[i]}</h3>

<p>${summaries[i]}</p>

<p>${ratings[i]}</p>

</div>

`;

}

// Store the value of the htmlCode variable in the inner HTML of the element with the ID list

document.getElementById("list").innerHTML = htmlCode;

```

I hope this is what you were looking for!

Step-by-step explanation:

User Eric Svitok
by
8.3k points