Learn Basic String and Array Methods by Building a Music Player - Step 59

Tell us what’s happening:

Can someone Please point out what’s wrong with my code??

### Your code so far

const setPlayButtonAccessibleText = () => {
  const song = userData?.currentSong || userData?.songs[0];
//editable area
playButton.setAttribute("aria-label", `song?.title ? \Play ${song.title} : "Play"`)  
//editable area
};

Your browser information:

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

Challenge Information:

Learn Basic String and Array Methods by Building a Music Player - Step 59

this what i got from the hint in the question but it still didn’t run i need help Please

playButton.setAttribute("aria-label", song?.title ? \Play ${song.title}` : "Play"`) 

You have two problems. Remember to check your matching `, ", ', etc.

  1. Your opening ` is missingfor the true portion of the ternary.
  2. You have an extra ` after your false “Play” string.

The line below works for me.

playButton.setAttribute("aria-label", song?.title ? `Play ${song.title}` : "Play");
1 Like

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