I don’t what is required of me in this step…almost everything I did so far is new and does not stick because it is mind boggling. ChatGPT is also clueless
A call back inside the fiiter method is needed. An implicit return is what it is asking for this wont have curly brackets. It might be a good idea here to stop and read up on the subject of a call back function with a implicit return. Good luck
This is typical. GPT doesn’t know anything and just guesses statistically likely combinations of words.
This is the key part of the instructions
Use the filter() method on userData?.songs. Pass in song as the parameter of the arrow function callback and use implicit return to check if song.id is strictly not equal to id. Assign all of that to the userData.songs.
Specifically
Use the filter() method on userData?.songs.
You aren’t quite doing this.
Pass in song as the parameter of the arrow function callback and use implicit return to check if song.id is strictly not equal to id.
You are passing in song, but have no arrow function.
Word of advice, you shouldn’t trust ChatGPT. Especially if you don’t know what you are doing. It will always tell you what you think you want to hear and sounds right; versus the actual answer to your problems.
Secondly you are close to the right track. You need to make sure you don’t call userData when it could potentially be undefined. That is why you use the null operator.
userData?.songs
Next, you need to insert an arrow callback function into the filter method. If you are unaware an arrow function generally takes this form,
(a,b, c) => expression
where all parameters are enclosed in a parentheses with an arrow pointing at the expression. More info on arrow functions can be found here.
The function you need to add goes inside of the filter method to find the song that has the id you are looking for. This type of function is called a callback function.
Optional chaining? I think I mentioned that almost everything is new in this music player project… even the code I’ve been writing throughout this project has been by luck in some cases… I don’t even know what this code is: userData.songs.filter(song => song.id !== id);
Maye I should memorise things to learn faster and avoid the frustration