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

Tell us what’s happening:

Hi Campers please I need your help as this is my first time posting here.
JavaScript algorithm and data structure step 74. Code is correct and yet won’t pass.

Step 74

The setPlayButtonAccessibleText function will set the aria-label attribute to the current song, or to the first song in the playlist. And if the playlist is empty, it sets the aria-label to "Play".

Use the setAttribute method on the playButton element to set an attribute named "aria-label". For the value, use a ternary to set song?.title to Play ${song.title} or "Play" if there’s no song.title available.

Don’t forget you need template interpolation here, so you need to use backticks.

playButton.setAttribute(“aria-label”, song?.title ? play ${song.title} : “play”);

Your code so far

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

/* file: styles.css */

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

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

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

Challenge Information:

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

Hello, if you are certain that the code is good try resetting the challenge and run it again.

Capitalization matters here

Wao! Code passed yippy! Thanks so much for this sir. I could not meet up my target for today no thanks to step 70 and 74, 70 especially lol.

Capitalization screwed me. Thanks so much for your input sir.

1 Like

I think the


as included in the box for


should be removed. It seems confusing to be considered as part of the code.

Thank you for helping make FCC better. Bugs can be reported as GitHub Issues. Whenever reporting a bug, please check first that there isn’t already an issue for it and provide as much detail as possible.

1 Like