Learn-modern-javascript-methods-by-building-football-team-cards - Step 26

playerCards.innerHTML += arr.map(() => {

})

Can you state what is going on please? Any error or fail masseages? A line of code with no explanation of what you need help with doesn’t help us help you.

// Assuming playerCards is a reference to an HTML element with id="playerCards"
playerCards.innerHTML += arr.map(() => {
    // The following code is inside the map function,
    // which is applied to each element of the array 'arr'
    // but it doesn't seem to do anything specific for each element.
    // The map function is used for creating a new array based on the original array.

    // The function inside map is empty, so it doesn't perform any operation on each element.
    // If you have more code inside the map function, it would be executed for each element in 'arr'.

    // The result of the map function is being concatenated to the existing HTML content of 'playerCards'
    // using the '+=' operator on the innerHTML property.

    // Note: If there's no other code within the map function, this code won't have any visible effect
    // on the HTML content of 'playerCards'.
})

We still need to know what problem you are having.

Thank you for your response! I don’t have a specific problem at the moment. I shared this code for others to review

2 Likes

I greatly appreciate it. I was stuck!

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.