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 Interacting with the DOM Traversing the DOM Traversal Review

What is the answer to parentOfDiv question?

The question is: In the code below, the constant div contains a reference to a DOM element. Select its parent node and store that in the constant parentOfDiv.

const div = document.querySelector('div');

const parentOfDiv =

and I try to complete the question with div.parentNode; but it says my answer is incorrect. I tried 5x already and making sure punctuation and capitalization are correct.

What is the answer? This is the old community post, I think my answer should've been correct? https://teamtreehouse.com/community/how-to-select-a-parent-node-and-store-it-in-a-constantdiv

The quiz currently accepts div.parentNode without the semicolon.

thank you so much jb30! it worked

1 Answer

Steven Parker
Steven Parker
231,269 Points

I got a correct answer result by entering div.parentNode; (with the semicolon).

they must've fixed the answer, it didn't accept with semicolon before :)