Learn Modern JavaScript Methods by Building Football Team Cards - Step 18

Tell us what’s happening:

I have written the code as described, but it is still putting out the error message. What is going on?

Your code so far

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

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

let sport = typeOfSport.textContent;


// User Editable Region
/* file: styles.css */

Your browser information:

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

Challenge Information:

Learn Modern JavaScript Methods by Building Football Team Cards - Step 18

Welcome to the forum @aliemeka7

Below your destructuring assignments, assign the sport variable to typeOfSport.textContent .

Assign to means the variable goes on the left hand side of the equals sign.

Happy coding

“sport” is the variable, right, it is on the left side or is there something else I am missing

you need to assign TO typeOfSport.textContent, so that means that typeOfSport.textContent needs to be on the left of the equal sign

1 Like

Thank you, it works, but I’m sort of confused. Is ‘sports’ not the variable? By assigning the value in typeOfSport.textContent to it, is it not supposed to be on the left and typeOfSport.textContent on the right of the equality sign.

By the way, there is a red underline error in the period of the typeOfSport.textContent

Hello and welcome to the forum community @aliemeka7 !

The reason the red line is showing is because typeOfSport was already declared as a variable at the beginning.

Just remove the let and it will disappear, and pass, still.

Wishing you good progress on your coding journey. :slightly_smiling_face:

sport is a variable that contains a valua, and now we want to show that value inside the typeOfSport html element, so we write that line to put the value of sport in the text of the html element