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

Tell us what’s happening:

Working through Step 28, trying to add a click event listener to the playButton element, then use arrow syntax to pass in a callback with an empty pair of curly braces.

Where am I going wrong?

Your code so far

playButton.addEventListener("click", (playSong) => {});

Your browser information:

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

Challenge Information:

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

1 Like

Hi @g.ferderer ,

Add a click event listener to the playButton element, then use arrow syntax to pass in a callback with an empty pair of curly braces.

This is the part that matters - the top paragraph doesn’t include the instructions, you’re right there at the right idea. The top paragraph makes mention of playSong, but it’s actually not to be included.

So keep the same idea, kick out that function :slight_smile:

3 Likes

Also, just as an aside.

The playSong parameter you have probably isn’t what you think it is inside the handler. The event handler will be passed the event so in this case playSong inside your handler would be a PointerEvent object.

In any case, as said you do not want to add the playSong parameter.

3 Likes

Try this
playButton.addEventListener(“click”, () => {})

1 Like

playButton.addEventListener(“click”,()=>{});