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

Tell us what’s happening:

const sport = myFavoriteFootballTeam.sport;
const team = myFavoriteFootballTeam.team;
const { sport, team } = myFavoriteFootballTeam; ```

my object destructing appears correct but it won't pass, what am I not doing. I have searched the entire  Javascript forum and I would like some help, please.

### Your code so far


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

/* file: styles.css */

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


const sport = myFavoriteFootballTeam.sport;
const team = myFavoriteFootballTeam.team;
const { sport,team } = myFavoriteFootballTeam;

// 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/123.0.0.0 Safari/537.36

Challenge Information:

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

INSTRUCTIONS:
Rewrite the two lines of code below using the new destructuring syntax. Your answer should be one line of code.

It seems like you have the right idea, but you’re giving it three lines as an answer, remove these two

const sport = myFavoriteFootballTeam.sport;
const team = myFavoriteFootballTeam.team;

and you should be good to go

1 Like

The const before the destructuring syntax means you are declaring variables. And you can’t redeclare const variables.

const user = {
  name: 'John'
}

const name = user.name
const { name } = user; // SyntaxError: Identifier 'name' has already been declared
1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.