Tell us what’s happening:
playButton.setAttribute(“aria-label”,song?.title ? Play ${song.title} : “Play”);
can someone explain to me how the logic behind this works so I can understand better?
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; rv:149.0) Gecko/20100101 Firefox/149.0
Challenge Information:
Learn Basic String and Array Methods by Building a Music Player - Step 74