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

Tell us what’s happening:

Requesting assistance in understanding what I am being asked, and what I am perhaps not reflecting correctly.
I’m repeatedly requested to add an else block to the if statement. I thought I have done this by adding the curly braces.

Your code so far

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

/* file: styles.css */

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

  if (nextSongExists) {
    playNextSong(); 
    else {userData?.currentSong = null; userData?.songCurrentTime = 0}
}


// 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/123.0.0.0 Safari/537.36

Challenge Information:

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

Hi @nyambura.mwagiru !

The content of your else statement looks fine, but the location of your else is not. Here’s what it looks like without the extra stuff

if (condition) {
    else {}
}

and here’s what it should be

if (condition) {
  
} else {}

Happy coding!

1 Like

A big thanks for the signal. Just that adjustment made it work! Took me some time though. Much appreciated for the assistance and swift reply.
Best wishes.

I also had to take out the questions marks though so I still have to learn more about the precise notation.

Haha you and me both. I’m a bit further than you are with the JavaScript course, and some of the stuff still doesn’t make sense to me

1 Like

Keep going, and as I’ve just completed the Building a Music Player project, it is most encouraging to learn you’ve advanced beyond this point I’m hoping to make it to the finish line with this one. Every success to you…

1 Like