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 trialDomagoj Kirigin
16,392 PointsWhere 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
3,412 Pointsget 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);
}
lauralouise
14,853 PointsFor anyone copying and pasting the above --
return document.getElementbyId(this.id);
the I in Id needs to be capitalized!
Magnus Martin
44,123 PointsTo avoid confusion: "document.getElementById" in lowerCamelCase. The div's id is still all lowercase (this.id).