Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

For some reason i cant make totalPlayers to work.

Have them all written down correct, still dosnt work. Players show 4 in the array but it wont get passed into Stats.JS Console log from Stats ( const totalPlayers = props.players.lenght; console.log({totalPlayers});) shows undefind reference ? dunno why it dosnt work. Anyone knows ?

3 Answers

It would help if you could provide complete code and a link to the video but from what you provided you have a typo with length:

props.players.lenght

Thank you for your answer. In the App.JS i got under render : <Header title="Scoreboard" players= { this.state.players }

in Header.JS i got <Stats players= {props.players}/>

and finaly in the Stats.js i got : const totalPLayers = props.players.lenght;

so im sending the array (that contains 4 players (same as Guil) to the child component Stats.js through the header and app. when i de-bugg and logg i find that " props.players.lenght " is undefined in Stats.js but i dont understand why

Btw: if you could tell me how i can post screenshot of the code here i appritiate it :)