Learn Basic String and Array Methods by Building a Music Player - Step 25

Step 25

Add an else block to handle the current song’s position in the playlist.
Within the else block, set the currentTime property of the audio object to the value stored in userData.songCurrentTime.
The code so far

if (userData?.currentSong === null || userData?.currentSong.id !== song.id) {
    audio.currentTime = 0;
  }

Below is my answer, but it keeps return

Sorry, your code does not pass. Don’t give up.
You should add an else block to the existing if block.

if (userData?.currentSong === null || userData?.currentSong.id !== song.id) {
  audio.currentTime = 0;
} else{
  audio.currentTime = userData.currentSongTime;
}

Please help

It’s possible that the tests are having trouble without a space between else and {.

3 Likes

hello! @twghydc4b01

The problem is with the typo in variable name. The right name is userData.songCurrentTime

Yep! along with the point @ArielLeslie mentioned. Then it will work!

Good luck!

1 Like

Opened github issue Music Player step 25 too strict with spacing.

2 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.