Learn Modern JavaScript Methods by Building Football Team Cards - Step 27

Tell us what’s happening:

it Says add a space between “(Captain)” and name, I have done that still showing error. const setPlayerCards = (arr = players) => {
playerCards.innerHTML += arr.map(
({ name, isCaptain }) => {
return <div class="player-card"> <h2>${isCaptain ? "(Captain)" : ""} ${name}</h2> </div> ;
}
).join(‘’);
};

Your code so far

<!-- file: index.html -->

/* file: styles.css */

/* file: script.js */
// User Editable Region


  const setPlayerCards = (arr = players) => {
  playerCards.innerHTML += arr.map(
    ({ name, isCaptain }) => {
      return `
        <div class="player-card">
          <h2>${isCaptain ? "(Captain)" : ""} ${name}</h2>
        </div>
      `;
    }
  ).join('');
};


// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36

Challenge Information:

Learn Modern JavaScript Methods by Building Football Team Cards - Step 27

Welcome to the forum. Can you show an example of the output?

Sorry, your code does not pass. Hang in there.

You should use a ternary operator to check if isCaptain is true and return "(Captain)" or return an empty string. This is the output.

where does this come from?

you should not make extra changes than what is asked

you will need to reset the step and try again, do only what is written in the instructions

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