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

Tell us what’s happening:

explain me the mistake even if it is silly i have tried searching

Your code so far

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

/* file: styles.css */

/* file: script.js */
// User Editable Region

  if (userData?.currentSong === null) {
    playSong(userData?.songs[0].id);
  } else {
    const currentSongIndex = getCurrentSongIndex();

  }
const nextSong = userData?.songs[currentSongIndex + 1];
 playSong(nextSong.id);
 

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36

Challenge Information:

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

Your code is correct but it should be part of the else clause, not outside of it.

1 Like