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 JavaScript and the DOM (Retiring) Getting a Handle on the DOM Selection Review

cant store the body into const body. I've tried my answer in the dom on chrome and it works fine.

my code. const body = document.getElementsByTagName('body');

tried without s after elements, with no semi colon, and with quotes around the argument body. nothing will answer the question correctly, but i run that code in the dom, and it returns a collect of html with the name body in it. am i doing something wrong, or is it just this questions?

2 Answers

Steven Parker
Steven Parker
231,275 Points

The quiz is asking you how to "select the body element", and not a collection. They even give you this reminder: "Hint: Don't forget that this method returns a collection, not a single element."

So what you're missing is something to return just the element from that collection.

Adam Beer
Adam Beer
11,314 Points

You need to give an index value.