Tell us what’s happening:
This is my code:
if (song) {
audio.src = song.src;
audio.title = song.title;
} else {
console.log(‘Song not found’);
}
The response that comes back after I check my code says I should set “audio.src” to “song.src”. Not sure where I am going wrong.
Is someone able to tell me where to change my code? Thanking you.
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;
} else {
console.log('Song not found');
}
};
// 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/127.0.0.0 Safari/537.36 Edg/127.0.0.0
Challenge Information:
Learn Basic String and Array Methods by Building a Music Player - Step 37