Tell us what’s happening:
It’s what I did; darn it! It won’t pass!
Step 37
Inside the playSong function, set the audio.src property equal to song.src. This tells the audio element where to find the audio data for the selected song.
Also, set the audio.title property equal to song.title. This tells the audio element what to display as the title of the song.
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
const playSong = (id) => {
const song = userData?.songs.find((song) => song.id === id);
if (song) {
audio.src = song.src;
audio.title = song.title;
}
};
// 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/138.0.0.0 Safari/537.36 Edg/138.0.0.0
Challenge Information:
Learn Basic String and Array Methods by Building a Music Player - Step 37