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 trialFuad Muhammad
4,273 PointsWhat is the correct answer of this?
I have been typed the answer was correct, but still bummer? const body = document.getElementsByTagName('body'); It is wrong?
1 Answer
Boris Yastrebov
11,713 PointsAs far as I see you're using getElementsByTagName() method, please notice that this method returns an array, dont forget to use bracket notation to access it . So the correct answer is:
const body = document.getElementsByTagName('body')[0];
Alexander Davison
65,469 PointsAlexander Davison
65,469 PointsActually,
document.getElementsByTagName()
doesn't return an array, but returns a type pretty similarIt returns something like a node list. I'm not 100% sure if that's what it's called, but I'm sure that it doesn't return an array.