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

Hi,

This is not really an asking for help post but more like a suggestion post. I understand the Javascript course is in beta and devs are probably aware of these mistakes but just in case I’d like to point it out.

Step 29 says this:
" Before playing the song, you need to make sure it starts from the beginning. This can be achieved by the use of the currentTime property of the audio object.

Add an if statement to check whether the userData?.currentSong is null or if userData?.currentSong.id is strictly not equal song.id. Inside if block, set the currentTime property of the audio object to 0. "

Based on this, my answer was:

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

And the correct answer would be:

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

Now I don’t mean to be pedantic, but the text doesn’t really say I have to strictly declare userData?.currentSong to be null. Adding to this, when I click Check your Code it doesn’t really do anything, it doesn’t really show me an error, which has happened to me multiple times during this specific course. Personally it doesn’t bother me because it gets me to find a workaround, but I suppose this isn’t really a feature.

Challenge Information:

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

Welcome to the forum @deadnoises

The first condition of your if statement is not making a comparasion, it it making an assignment.

So, this is a case of not having enough equal signs.
This is a code logic error, not a syntax error.

This is a feature, because it teaches you to debug.

Happy coding

Right, I see. As i mentioned: yes, it gets me to find a workaround. I’m not sure about the “Check your Code” not even showing an error thing though, but I get it. Thanks for your quick reply!