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

Tell us what’s happening:

I’ve been trying to pass this step but I’m not certain where I could’ve went wrong when setting userData?.currentSong to null. I tried using the strict equality operator(===) and the loose equality operator(==) since I get an error in the console when using the assignment operator but I still get the same message.

Your code so far

if (userData?.currentSong?.id === id) {
userData?.currentSong === null;
userData?.songCurrentTime === 0;
pauseSong();
setPlayerDisplay();
};

WARNING

The challenge seed code and/or your solution exceeded the maximum length we can port over from the challenge.

You will need to take an additional step here so the code you wrote presents in an easy to read format.

Please copy/paste all the editor code showing in the challenge from where you just linked.

  if (userData?.currentSong?.id === id) {
  userData?.currentSong === null;
  userData?.songCurrentTime === 0;
  pauseSong();
  setPlayerDisplay();
  };

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36

Challenge Information:

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

There is an error in the instructions that was recently fixed here

But also, this part should not use the equality operator

You should use assignment instead.

once you make those changes, then the test will pass

1 Like

I just tried the using the assignment operator but I’m still getting the error from the console.

//this is the error I get from the console when using the assignment operator//

SyntaxError: unknown: Support for the experimental syntax 'optionalChainingAssign' isn't currently enabled (148:3):

  146 | const deleteSong = (id) => {
  147 |   if (userData?.currentSong?.id === id) {
> 148 |   userData?.currentSong = null;
      |   ^
  149 |   userData?.songCurrentTime = 0;
  150 |   pauseSong();
  151 |   setPlayerDisplay();

remove the optional chaining from there

I got it. Thank you.