Tell us what’s happening:
Hi
This is my code:
const playPreviousSong = () => {
if(userData?.currentSong === null){
return;
}else {
const currentSongIndex = getCurrentSongIndex();
}
};
The response I get when trying to pass my code is that I need to call the “playSong” function with “userData.songs[0].id” inside your “if” block"
Can anyone tell me where I am going wrong please?
Thanking you
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
const playPreviousSong = () => {
if(userData?.currentSong === null){
return;
}else {
const currentSongIndex = getCurrentSongIndex();
}
};
// 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 43