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

Tell us what’s happening:

Hi, people, could you please help me with this stage? The “song.id” is underlined with red and my code doesn’t pass, but I can’t understand what’s the reason

Your code so far

<!-- file: index.html -->

/* file: styles.css */

/* file: script.js */
// User Editable Region

const playSong = (id) => {
const song = userData?.songs.find((song) song.id === id);
};

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Linux; arm_64; Android 13; RMX3191) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.6261.39 YaBrowser/24.4.7.39.00 SA/3 Mobile Safari/537.36

Challenge Information:

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

You’re missing something related to the arrow function syntax.

Take a look here at your playSong function:

1 Like

Mostafa, could you, please, provide me another hint or a link to the relevant article? It looks like now I’m even more confused than before :eyes:

I searched in the Internet for the answer, tried to validate my code, I can that there is something wrong with it, but I do not have an idea what exactly I did wrong

what have you written?

let arr = [1, 2, 3, 4];
let newArr = arr.map((number) => number + 1);

console.log(newArr);     // [ 2, 3, 4, 5 ]

compare both:

(song) song.id === id
(number) => number + 1

and you should see what you’re missing

2 Likes

Finally, thank you :smiling_face: It have taken me too long to find it, omg :thinking:

1 Like