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

Tell us what’s happening:

I think I have a problem with resetButton.setAttribute, I don’t know if I have to write it differently, like resetButton.ariaLabel.
if (userData?.songs.length === 0) {
const resetButton = document.createElement(“button”);
const resetText = document.createTextNode(“Reset Playlist”);
resetButton.id = “reset”;
resetButton.setAttribute(‘aria-label’, ‘Reset playlist’);
}

Your code so far

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

/* file: styles.css */

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

  if (userData?.songs.length === 0) {
    const resetButton = document.createElement("button");
    const resetText = document.createTextNode("Reset Playlist");
      resetButton.id = "reset";
      resetButton.setAttribute('aria-label', 'Reset playlist'); 
  }

// User Editable Region

Your browser information:

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

Challenge Information:

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

I don’t know if I have to write it differently, like resetButton.ariaLabel.

Why don’t you try that.

I have tried, but it seems to have a different syntax, i don’t kow

Show that code, please.

The whole script or just:
if (userData?.songs.length === 0) {
const resetButton = document.createElement(“button”);
const resetText = document.createTextNode(“Reset Playlist”);
resetButton.id = “reset”;
resetButton.ariaLabel(‘aria-label’, ‘Reset playlist’);
}

you used this syntax to set id

so now why are you using this one to set an other attribute using the same dot notation?

2 Likes

Because the hint literally suggests that I use resetButton.ariaLabel to create an "aria-label"

But arialLabel is not a function and you’re using it like it is. Use the same syntax you used to assign the id. It’s that simple.

1 Like

Thanks guys, I finally understood what this simple mistake was.

1 Like