Build a Music Player - Step 35

Tell us what’s happening:

so in this step 35, it’s asking me for: If you press the previous button when no song is playing, the first song will play. To fix this, add an if statement at the beginning of the playPreviousSong function. Check if the current song is null and stop the function execution with a return statement. so i did: const playPreviousSong = () => {
if (userData.currentSong === null) {
return;
} and still doesn’t work, i dont know what else can i do

Your code so far

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

/* file: styles.css */

/* file: script.js */
// User Editable Region
  const playPreviousSong = () => {
  if (userData.currentSong === null) {
    return;
  }
  const previousSong = getPreviousSong();
  if (previousSong) {
    playSong(previousSong.id);
  } else {
    playSong(userData.songs[0].id);
  }
};
// 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/149.0.0.0 Safari/537.36

Challenge Information:

Build a Music Player - Step 35

GitHub Link: freeCodeCamp/curriculum/challenges/english/blocks/workshop-music-player/675340b809683f45cae96539.md at main · freeCodeCamp/freeCodeCamp · GitHub

Hey @eliasrecalde9

I went through lab file and found that test is expecting implicit return only. If you use implicit return instead of explicit return, you’ll pass the test. I’ll raise an issue on this so that future campers don’t face this issue.