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 Object-Oriented JavaScript: Challenge Rendering the Game Rendering the Spaces, Board, and Tokens Solution

Domagoj Kirigin
Domagoj Kirigin
16,392 Points

Where is the solution for getter method, htmlToken()?

Hi, I do not see explained solution for getter method, htmlToken() in this video.

2 Answers

Marco Cornejo
Marco Cornejo
3,411 Points
get htmlToken() {
     /*Basically, it returns the Element of the token.
     The instructor created 'div' element and stored it in 'const token'
     This getter would return that specific 'div' element */
     return document.getElementbyid(this.id);
14,852 Points

For anyone copying and pasting the above --

return document.getElementbyId(this.id);

the I in Id needs to be capitalized!

To avoid confusion: "document.getElementById" in lowerCamelCase. The div's id is still all lowercase (this.id).