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

Tell us what’s happening:

I cannot get the ternary operator to work to test if isCaptain is true. Can anyone tell me what I’m doing wrong?

Your code so far

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

/* file: styles.css */

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


  playerCards.innerHTML += arr.map(
    ({ name, position, number, isCaptain, nickname }) => {
      `
        <div class="player-card">
          <h2>${name} ${isCaptain ? "(Captain)" : ""}</h2>
          
        </div>
      `;
    }
  );


// 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/125.0.0.0 Safari/537.36 Edg/125.0.0.0

Challenge Information:

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

You got it, except a small detail:

Before the ${name} expression

I’m feeling very stupid - it’s obviously something really simple but I can’t see what’s missing before the ${name} expression

Your new ternary should go before it, not following. Quoting the instructions here:

Before the ${name} expression, add a new embedded expression.

and welcome to the forum!

Thanks a lot! It’s been a long day. So annoyingly simple :man_facepalming:

1 Like

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