:earn basic String and Array Methods by Building a Music Player - Step 67

I’ve tried multiple solutions. Can anyone tell me where I screwed up?

const deleteSong = (id, song) => {
  userData?.songs = userData?.songs.filter(song.id !== id)
};

no need to pass song as a parameter here

Think about - do you need optional chaining here?

Revise the filter’s callback function. Maybe you need to pass some parameter , here, and not to deleteSong it self?

const deleteSong = (id) => {
  userData.songs = userData.songs.filter(song.id !== id)
};

it’s still not correct, and when I remove the optional chainining it says that the filter method should be assinged to it.

still some work is needed about this part

in your first code example, you had optional chaining in two places. You do need optional chaining in one of them. I did not mean that you do not need it like at all in this exercise.

1 Like

thank you I appreciate the kind help. I was able to solve it.

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