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

Tell us what’s happening:I really need help. I am having great difficulty with step 76 . I have tried multiple methods, none of which are working.

Your code so far

const deleteSong = (id) => {

};

const userDatasongs = userData.songs.filter((song) => userData.songs = song.id !== false);

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.

Replace these two sentences with your copied code.
Please leave the ``` line above and the ``` line below,
because they allow your code to properly format in the post.

Your browser information:

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

Challenge Information:

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

1 Like

can you show what you have tried please?

1 Like

if it is this, it needs to go inside deleteSong function

1 Like

Is this code correct to place inside the deleteSong function?

I have not checked, but the task is to write the functionality of the deleteSong function, so if you write outside of it you are not writing correctly

I placed the code inside the function. I am really unsure of how to write the song.id !== id portion of the functionality of the code

good job! now what happens?

I’m need an idea of how to write the song.id !== id portion of the code as well as the implicit return

implicit return means that you don’t use the return keyword, and don’t use the {}, so you write () => thing_to_return

do not assign inside the filter method

I’m still having great difficulty. I am now getting an error that says “Do not modify the deleteSong function”. Do you have any suggestion on how I can overcome this bump in the road?

I have no idea, you need to provide more infos. Showing your code is a good start, what is the code you have written?

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

Assign all of that to the userData.songs .

You are assigning to userDatasongs, please change that

remove userData.songs here, do not assign, only do the comparison here

remove this

I’ve made some of the changes you suggested, including removing the curly braces and modifying the variable it’s assigned to, but I’m still stuck.

Here’s my latest code:

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

I’ve been struggling with this for several hours

you need to assign the output of filter to userData.songs, now you are not assigning to anything

Take what you have here and assign it to userData.songs, but then you have to check that “song.id !=== id”

Here is an example of a filter

filter(item=> item.id !== id)

That is it nothing more complex need to happen.

Just assign that to the field userData.songs

Here is a great article about it with examples: mdn filter